1 | #include <boost/graph/adjacency_list.hpp>
|
---|
2 | #include <boost/graph/vf2_sub_graph_iso.hpp>
|
---|
3 |
|
---|
4 | int main() {
|
---|
5 | using namespace boost;
|
---|
6 |
|
---|
7 | typedef adjacency_list<vecS, vecS, bidirectionalS> graph_type;
|
---|
8 |
|
---|
9 | // Build graph1:
|
---|
10 | //
|
---|
11 | // (0) ---> (1)
|
---|
12 | //
|
---|
13 | graph_type graph1(2);
|
---|
14 | add_edge(0, 1, graph1);
|
---|
15 |
|
---|
16 | // Build graph2:
|
---|
17 | //
|
---|
18 | // +--------+
|
---|
19 | // V |
|
---|
20 | // (0) ---> (1) ---> (2)
|
---|
21 | //
|
---|
22 | graph_type graph2(3);
|
---|
23 | add_edge(0, 1, graph2);
|
---|
24 | add_edge(1, 2, graph2);
|
---|
25 | add_edge(2, 1, graph2);
|
---|
26 |
|
---|
27 | std::cout << "Expected result (in random order):\n"
|
---|
28 | << "(0, 0) (1, 1)\n"
|
---|
29 | << "(0, 1) (, 2)\n"
|
---|
30 | << "(0, 2) (1, 1)\n"
|
---|
31 | << "\n";
|
---|
32 | std::cout << "Actual result:\n";
|
---|
33 |
|
---|
34 | vf2_print_callback<graph_type, graph_type> callback(graph1, graph2);
|
---|
35 | vf2_subgraph_iso(graph1, graph2, callback);
|
---|
36 |
|
---|
37 | return 0;
|
---|
38 | }
|
---|
39 |
|
---|