[Lemon-commits] [lemon_svn] marci: r791 - hugo/trunk/src/work/marci

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:41:31 CET 2006


Author: marci
Date: Tue May 11 17:54:00 2004
New Revision: 791

Modified:
   hugo/trunk/src/work/marci/top_sort_test.cc

Log:
misc


Modified: hugo/trunk/src/work/marci/top_sort_test.cc
==============================================================================
--- hugo/trunk/src/work/marci/top_sort_test.cc	(original)
+++ hugo/trunk/src/work/marci/top_sort_test.cc	Tue May 11 17:54:00 2004
@@ -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 << " ";
+    }
+    cout << endl;
+    
+    FOR_EACH_LOC(Graph::NodeIt, n, g) {
+      cout << "pred of node " << n << " is " << pred[n] << endl;
     }
-    std::cout << std::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 << " ";
+    }
+    cout << endl;
+
+    FOR_EACH_LOC(GW::NodeIt, n, gw) {
+      cout << "pred of node " << n << " is " << pred[n] << endl;
     }
-    std::cout << std::endl;
   }
 
   return 0;



More information about the Lemon-commits mailing list