Next Previous Contents

3.2 Choosing the matching algorithm

In order to perform the matching, you have to choose which kind of relation you are interested in (e.g. isomorphism), and which algorithm you want to use. To make this choice, you need to create an instance of a class derived from the State class, which represents the starting point in the search space of the algorithm. Table Matching algorithms presents the available choices.


Class Header file Relation Algorithm
SDState sd_state.h isomorphism Schmidt-Druffel
UllState ull_state.h isomorphism Ullmann
VFState vf_state.h isomorphism VF
VF2State vf2_state.h isomorphism VF2
UllSubState ull_sub_state.h graph-subgr. isom. Ullmann
VFSubState vf_sub_state.h graph-subgr. isom. VF
VF2SubState vf2_sub_state.h graph-subgr. isom. VF2
VFMonoState vf_mono_state.h monomorphism VF
VF2MonoState vf2_mono_state.h monomorphism VF2
Matching algorithms

Once you have chosen the right class, you need to create an instance of it, passing to the constructor a pointer to the two graphs being matched. If the matching relation is graph-subgraph isomorphism or monomorphism, the role of the two graph is not symmetric. In this case, the first constructor parameter must be the smallest of the two graphs.

For example, suppose you need to perform a graph-subgraph isomorphism, and decide to use the VF2 algorithm. The code needed to initialize the search state is:


#include "argraph.h"
#include "argedit.h"
#include "vf2_sub_state.h"

int main()
  { ARGEdit small_ed, large_ed;
    //... some code here should construct the graphs ...
        Graph small_graph(&small_ed), large_graph(&large_ed);

    // Create the initial state of the search space
        VF2SubState s0(&small_graph, &large_graph);

    //... to be continued ...


Next Previous Contents