VF

An efficient graph isomorphism algorithm

C++ implementation, rel. 0.9b

Installation and User Guide

back to the VF home page


Contents


Introduction

This document describes a preliminary release of the C++ implementation of VF, an efficient graph isomorphism algorithm decribed in [1]. We provide this release for allowing tests of the performance of our algorithm and comparisons with other algorithms. For this reason, we have included in this distribution an implementation of Ullman's algorithm [2].

Coming soon

Since the porting from Prolog to C++ is still in progress, this release is not yet complete. In particular, the following features will be added in the next release:


Contacting the authors

This software has been developed by the Artificial Vision Group of the "Federico II" University of Naples, Italy. For more information, please send a letter or an e-mail to:


Installing the software

Requirements

The software has been tested on a SPARCStation 20 with SunOS 4.1.3 and gcc 2.3.3, and on a PC with Linux 2.0.0 and gcc 2.7.2.

The C and C++ files should be portable on other operative systems.

Compiling the software

After unpacking the file sources.tgz using the command

in the proper directory, you should edit the file Makefile according to your system configuration. Then you can compile with the command make.

After the compilation, if no error occurs, you will have 3 executable programs: matcher, ull_matcher and gene.


Using the software

The software provided consists of 3 programs, matcher, ull_matcher and gene, and some nawk scripts to partially automate the testing phase. Each of these programs is described in one of the following subsections.

matcher and ull_matcher

These programs perform a graph matching using VF and Ullman's algorithm. They can either find and display the first isomorphism between two graphs, or find all the existing isomorphisms, printing only the overall time spent in the matching process. The input graphs are represented by means of their adjacency matrices, specified as text files using the format:

where N is the number of nodes, and Aij is 1 if there is a branch from node i to node j, 0 otherwise.

The usage of the programs is:

where the keyword all is used to find all the isomorphisms, and rep is a repetition count, used to repeat the matching operations for a number of times sufficient to require a time interval which can be measured with enough precision by the system clock. The usage of ull_matcher requires the same parameters.

Examples of invocations of this programs are:

gene

This program is used to randomly generate pairs of isomorphic graphs with a given number of nodes and branches. It ensures that the resulting graphs are connected, adding more branches than requested if necessary. The graphs are stored in text files using the format described in the previous subsection.

The usage of the program is:

genbatch.awk

This program generates a shell script for performing a test of the two matching algorithms (ours and Ullman's).

The usage is:

where:

node_file is the name of a text file containing the number of nodes to be used. Each line contains a number of nodes and a corresponding repeat count.

branch_file is the name of a text file containing the ratios of branches to be used. Each line contains a real number in [0,1] which is the ratio between the desired number of branches and the square of the number of nodes

script_file is the test shell script. You must change by hand the permissions of this file, with

The script output by genbatch.awk tests every combination of number of nodes and number of branches, generating 125 graphs and applying the two algorithms. The results are written on standard output, which should be redirected to a file to be furtherly processed by mktable.awk

Example: using the following node_file:

and the following branch_file:

the generated script tests the following combinations of nodes, branches and repetitions:

nodes

branches

rep

40

160

20

40

800

20

50

250

10

50 1250 10

mktable.awk

This program examines the results of a shell script generated by genbatch.awk computing averages and standard devs for the matching times, and outputs a table with these data

Usage:

Example:

Using the same node numbers and branch ratios of the example in the previous subsection, the resulting table is:

where the first column contains the number of nodes, and the other two the average time in seconds and its standard deviation.


References

  1. L. P. Cordella, P. Foggia, C. Sansone, M. Vento, "An Efficient Algorithm for the Inexact Matching of ARG Using a Contextual Transformational Model", in Proceedings of the 13th ICPR, IEEE Computer Society Press, vol. III, pp. 180-184 (1996)
  2. J. R. Ullman, "An Algorithm for Subgraph Isomorphism", Journal of the Association for Computing Machinery, 23, pp. 31-42 (1976)