-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
46 lines (40 loc) · 1014 Bytes
/
Copy pathmain.cpp
File metadata and controls
46 lines (40 loc) · 1014 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <iostream>
#include <CoffmanGrahamAlgorithm.h>
int main() {
Graph g({Edges({ Vertex(9) }),
Edges({ Vertex(0), Vertex(7), Vertex(8) }),
Edges({ Vertex(1), Vertex(3) }),
Edges({ Vertex(5), Vertex(6), Vertex(7), Vertex(9) }),
Edges(),
Edges(),
Edges(),
Edges({ Vertex(8) }),
Edges({ Vertex(10), Vertex(11) }),
Edges({ Vertex(10) }),
Edges({ Vertex(12) }),
Edges({ Vertex(12), Vertex(13) }),
Edges({ Vertex(14) }),
Edges({ Vertex(14) }),
Edges()
});
PrintGraph(g);
CoffmanGrahamAlgorithm algorithm(g, LayeringWidth(4));
auto layers = algorithm.Apply();
// // test reversing
// PrintGraph(algorithm.GetReversed());
//
// // test labeling
// for (int label : algorithm.GetLabels()) {
// cout << label << " ";
// }
// cout << endl;
// print layers
cout << layers.size() << endl;
for (auto it = layers.rbegin(); it != layers.rend(); it++) {
for (auto v : *it) {
cout << v.get() << " ";
}
cout << endl;
}
return 0;
}