# HG changeset patch # User marci # Date 1084290840 0 # Node ID 0566ac97809bc6a7d228dfe0d7c5fdfff70cee69 # Parent 84b04b70ad89c83c9c3c1b0a83b8576b29f17dfd misc diff -r 84b04b70ad89 -r 0566ac97809b src/work/marci/top_sort_test.cc --- a/src/work/marci/top_sort_test.cc Tue May 11 15:44:58 2004 +0000 +++ b/src/work/marci/top_sort_test.cc Tue May 11 15:54:00 2004 +0000 @@ -8,35 +8,50 @@ #include #include #include +#include using namespace hugo; +using std::cout; +using std::endl; + int main() { typedef ListGraph Graph; Graph g; readDimacs(std::cin, g); + { std::list l; - NullMap pred; + //NullMap pred; + Graph::NodeMap pred(g, INVALID); topSort(g, l, pred); - std::cout << "Leaving order of dfs which is pretopological..." << std::endl; + cout << "Leaving order of dfs which is pretopological..." << endl; for(std::list::const_iterator i=l.begin(); i!=l.end(); ++i) { - std::cout << *i << " "; + cout << *i << " "; } - std::cout << std::endl; + cout << endl; + + FOR_EACH_LOC(Graph::NodeIt, n, g) { + cout << "pred of node " << n << " is " << pred[n] << endl; + } } { typedef RevGraphWrapper GW; GW gw(g); std::list l; - NullMap pred; + //NullMap pred; + GW::NodeMap pred(gw, INVALID); topSort(gw, l, pred); - std::cout << "Same in the revered oriented graph..." << std::endl; + cout << "Same in the reversed oriented graph..." << endl; for(std::list::const_iterator i=l.begin(); i!=l.end(); ++i) { - std::cout << *i << " "; + cout << *i << " "; } - std::cout << std::endl; + cout << endl; + + FOR_EACH_LOC(GW::NodeIt, n, gw) { + cout << "pred of node " << n << " is " << pred[n] << endl; + } } return 0;