# 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 <list_graph.h>
 #include <hugo/graph_wrapper.h>
 #include <hugo/maps.h>
+#include <for_each_macros.h>
 
 using namespace hugo;
 
+using std::cout;
+using std::endl;
+
 int main() {
   typedef ListGraph Graph;
   Graph g;
   readDimacs(std::cin, g); 
+ 
   {
     std::list<Graph::Node> l;
-    NullMap<Graph::Node, Graph::Edge> pred;
+    //NullMap<Graph::Node, Graph::Edge> pred;
+    Graph::NodeMap<Graph::Edge> 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<Graph::Node>::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<Graph> GW;
     GW gw(g);
     std::list<GW::Node> l;
-    NullMap<GW::Node, GW::Edge> pred;
+    //NullMap<GW::Node, GW::Edge> pred;
+    GW::NodeMap<Graph::Edge> 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<GW::Node>::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;