equal
deleted
inserted
replaced
5 |
5 |
6 #include <hugo/dimacs.h> |
6 #include <hugo/dimacs.h> |
7 #include <bfs_dfs_misc.h> |
7 #include <bfs_dfs_misc.h> |
8 #include <list_graph.h> |
8 #include <list_graph.h> |
9 #include <hugo/graph_wrapper.h> |
9 #include <hugo/graph_wrapper.h> |
|
10 #include <hugo/maps.h> |
10 |
11 |
11 using namespace hugo; |
12 using namespace hugo; |
12 |
13 |
13 int main() { |
14 int main() { |
14 typedef ListGraph Graph; |
15 typedef ListGraph Graph; |
15 Graph g; |
16 Graph g; |
16 readDimacs(std::cin, g); |
17 readDimacs(std::cin, g); |
17 { |
18 { |
18 std::list<Graph::Node> l; |
19 std::list<Graph::Node> l; |
19 topSort(g, l); |
20 NullMap<Graph::Node, Graph::Edge> pred; |
|
21 topSort(g, l, pred); |
20 std::cout << "Leaving order of dfs which is pretopological..." << std::endl; |
22 std::cout << "Leaving order of dfs which is pretopological..." << std::endl; |
21 for(std::list<Graph::Node>::const_iterator i=l.begin(); i!=l.end(); ++i) { |
23 for(std::list<Graph::Node>::const_iterator i=l.begin(); i!=l.end(); ++i) { |
22 std::cout << *i << " "; |
24 std::cout << *i << " "; |
23 } |
25 } |
24 std::cout << std::endl; |
26 std::cout << std::endl; |
26 |
28 |
27 { |
29 { |
28 typedef RevGraphWrapper<Graph> GW; |
30 typedef RevGraphWrapper<Graph> GW; |
29 GW gw(g); |
31 GW gw(g); |
30 std::list<GW::Node> l; |
32 std::list<GW::Node> l; |
31 topSort(gw, l); |
33 NullMap<GW::Node, GW::Edge> pred; |
|
34 topSort(gw, l, pred); |
32 std::cout << "Same in the revered oriented graph..." << std::endl; |
35 std::cout << "Same in the revered oriented graph..." << std::endl; |
33 for(std::list<GW::Node>::const_iterator i=l.begin(); i!=l.end(); ++i) { |
36 for(std::list<GW::Node>::const_iterator i=l.begin(); i!=l.end(); ++i) { |
34 std::cout << *i << " "; |
37 std::cout << *i << " "; |
35 } |
38 } |
36 std::cout << std::endl; |
39 std::cout << std::endl; |