1.1 --- a/src/work/marci/bfs_dfs_misc.h Thu May 06 15:19:59 2004 +0000
1.2 +++ b/src/work/marci/bfs_dfs_misc.h Thu May 06 15:24:42 2004 +0000
1.3 @@ -50,10 +50,10 @@
1.4 if (!reached[n]) {
1.5 dfs.pushAndSetReached(n);
1.6 while (!dfs.finished()) {
1.7 + ++dfs;
1.8 if (dfs.isANodeExamined()) {
1.9 l.push_back(dfs.aNode());
1.10 }
1.11 - ++dfs;
1.12 }
1.13 }
1.14 }
2.1 --- a/src/work/marci/top_sort.dim Thu May 06 15:19:59 2004 +0000
2.2 +++ b/src/work/marci/top_sort.dim Thu May 06 15:24:42 2004 +0000
2.3 @@ -1,5 +1,6 @@
2.4 -p mat 5 4
2.5 +p mat 5 5
2.6 a 1 3
2.7 a 2 3
2.8 a 3 5
2.9 a 3 4
2.10 +a 5 4
2.11 \ No newline at end of file
3.1 --- a/src/work/marci/top_sort_test.cc Thu May 06 15:19:59 2004 +0000
3.2 +++ b/src/work/marci/top_sort_test.cc Thu May 06 15:24:42 2004 +0000
3.3 @@ -6,20 +6,35 @@
3.4 #include <hugo/dimacs.h>
3.5 #include <bfs_dfs_misc.h>
3.6 #include <list_graph.h>
3.7 +#include <graph_wrapper.h>
3.8
3.9 using namespace hugo;
3.10
3.11 int main() {
3.12 typedef ListGraph Graph;
3.13 Graph g;
3.14 - readDimacs(std::cin, g);
3.15 - std::list<Graph::Node> l;
3.16 - topSort(g, l);
3.17 - std::cout << "Leaving order of dfs which is pretopological..." << std::endl;
3.18 - for(std::list<Graph::Node>::const_iterator i=l.begin(); i!=l.end(); ++i) {
3.19 - std::cout << *i << " ";
3.20 + readDimacs(std::cin, g);
3.21 + {
3.22 + std::list<Graph::Node> l;
3.23 + topSort(g, l);
3.24 + std::cout << "Leaving order of dfs which is pretopological..." << std::endl;
3.25 + for(std::list<Graph::Node>::const_iterator i=l.begin(); i!=l.end(); ++i) {
3.26 + std::cout << *i << " ";
3.27 + }
3.28 + std::cout << std::endl;
3.29 }
3.30 - std::cout << std::endl;
3.31 +
3.32 + {
3.33 + typedef RevGraphWrapper<Graph> GW;
3.34 + GW gw(g);
3.35 + std::list<GW::Node> l;
3.36 + topSort(gw, l);
3.37 + std::cout << "Same in the revered oriented graph..." << std::endl;
3.38 + for(std::list<GW::Node>::const_iterator i=l.begin(); i!=l.end(); ++i) {
3.39 + std::cout << *i << " ";
3.40 + }
3.41 + std::cout << std::endl;
3.42 + }
3.43
3.44 return 0;
3.45 }