1 | #include <ogdf/graphalg/MaxAdjOrdering.h> |
2 | #include <ogdf/basic/graph_generators.h> |
3 | |
4 | #include <testing.h> |
5 | |
6 | go_bandit([](){ |
7 | describe("Maximum Adjacency Orderings" , [](){ |
8 | it("should calculate exactly all MAOs" , [](){ |
9 | for (int N = 4; N <= 8; N++){ |
10 | std::cout << " " << "Busy with graphs that have " << N << " nodes." << std::endl; |
11 | Graph P; |
12 | emptyGraph(P, N); |
13 | MaxAdjOrdering perms; |
14 | ListPure<ListPure<node>> allPerms; |
15 | perms.calcAll(&P,&allPerms); |
16 | |
17 | for (int i = 1; i < 10; i++){ |
18 | Graph G; |
19 | randomSimpleGraph(G,N,1*N); |
20 | |
21 | //make an instance for the MAOs |
22 | MaxAdjOrdering m; |
23 | |
24 | //make structures for saving all MAOs of G |
25 | ListPure<ListPure<node>> MAOs; |
26 | |
27 | //calculate them |
28 | m.calcAll(&G,&MAOs); |
29 | |
30 | AssertThat(m.testIfAllMAOs(&G,&MAOs,&allPerms), IsTrue()); |
31 | } |
32 | } |
33 | }); |
34 | it("should calculate MAOs with correct lex-bfs tie breaking" , [](){ |
35 | for (int N = 10; N <= 20; N++){ |
36 | std::cout << " " << "Busy with graphs that have " << N << " nodes." << std::endl; |
37 | |
38 | for (int i = 1; i < 10; i++){ |
39 | Graph G; |
40 | randomSimpleGraph(G, N, (N*(N-4))/2); |
41 | |
42 | //make an instance for the MAOs |
43 | MaxAdjOrdering m; |
44 | |
45 | //make structures for saving all MAOs of G |
46 | ListPure<node> MAO; |
47 | |
48 | //calculate them |
49 | m.calcBfs(&G,&MAO); |
50 | |
51 | AssertThat(m.testIfMAO(&G,&MAO), IsTrue()); |
52 | AssertThat(m.testIfMAOBfs(&G,&MAO), IsTrue()); |
53 | } |
54 | } |
55 | }); |
56 | }); |
57 | }); |
58 | |