[Lemon-commits] [lemon_svn] jacint: r316 - hugo/trunk/src/work/jacint

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


Author: jacint
Date: Sat Mar 20 21:06:23 2004
New Revision: 316

Removed:
   hugo/trunk/src/work/jacint/README_FLOW
Modified:
   hugo/trunk/src/work/jacint/dijkstra.h
   hugo/trunk/src/work/jacint/fib_heap.h
   hugo/trunk/src/work/jacint/makefile
   hugo/trunk/src/work/jacint/preflow.cc
   hugo/trunk/src/work/jacint/prim.cc

Log:
*** empty log message ***


Modified: hugo/trunk/src/work/jacint/dijkstra.h
==============================================================================
--- hugo/trunk/src/work/jacint/dijkstra.h	(original)
+++ hugo/trunk/src/work/jacint/dijkstra.h	Sat Mar 20 21:06:23 2004
@@ -80,7 +80,7 @@
       while ( !heap.empty() ) {
 	
 	Node v=heap.top(); 
-	T oldvalue=heap[v];
+	T oldvalue=heap.get(v);
 	heap.pop();
 	distance.set(v, oldvalue);
 	scanned.set(v,true);
@@ -94,7 +94,7 @@
 	      reach.set(w,true);
 	      heap.push(w,oldvalue+length[e]); 
 	      predecessor.set(w,e);
-	    } else if ( oldvalue+length[e] < heap[w] ) {
+	    } else if ( oldvalue+length[e] < heap.get(w) ) {
 	      predecessor.set(w,e);
 	      heap.decrease(w, oldvalue+length[e]); 
 	    }

Modified: hugo/trunk/src/work/jacint/fib_heap.h
==============================================================================
--- hugo/trunk/src/work/jacint/fib_heap.h	(original)
+++ hugo/trunk/src/work/jacint/fib_heap.h	Sat Mar 20 21:06:23 2004
@@ -143,20 +143,20 @@
     }
     
 
-
-
     PrioType& operator[](const Item& it) {
       return container[iimap[it]].prio;
     }
+
     
     const PrioType& operator[](const Item& it) const {
       return container[iimap[it]].prio;
     }
 
-//     const PrioType get(const Item& it) const {
-//       return container[iimap[it]].prio;
-//     }
 
+    const PrioType get(const Item& it) const {
+      return container[iimap[it]].prio;
+    }
+    
     void pop() {
       /*The first case is that there are only one root.*/
       if ( container[minimum].left_neighbor==minimum ) {

Modified: hugo/trunk/src/work/jacint/makefile
==============================================================================
--- hugo/trunk/src/work/jacint/makefile	(original)
+++ hugo/trunk/src/work/jacint/makefile	Sat Mar 20 21:06:23 2004
@@ -1,6 +1,6 @@
 CXX3 := $(shell type -p g++-3.3 || type -p g++-3.2 || type -p g++-3.0 || type -p g++-3 || echo g++)
 CXX2 = g++-2.95
-CXXFLAGS = -W -Wall -ansi -pedantic
+CXXFLAGS = -W -Wall -ansi -pedantic -O3 -I. -I.. -I../marci -I../alpar -I../../include  
 LEDAROOT ?= /ledasrc/LEDA-4.1
 
 BINARIES = dijkstra prim preflow
@@ -11,13 +11,13 @@
 sinclude .depend
 
 preflow: 
-	$(CXX3) $(CXXFLAGS) -O3 -I. -I.. -I../marci -I../alpar -o preflow preflow.cc 
+	$(CXX3) $(CXXFLAGS)  -o preflow preflow.cc 
 
 dijkstra: 
-	$(CXX3) $(CXXFLAGS) -O3 -I. -I.. -I../marci -I../alpar  -o dijkstra dijkstra.cc
+	$(CXX3) $(CXXFLAGS)  -o dijkstra dijkstra.cc
 
 prim: 
-	$(CXX3) $(CXXFLAGS) -O3 -I. -I.. -I../marci -I../alpar -o prim prim.cc
+	$(CXX3) $(CXXFLAGS)  -o prim prim.cc
 
 clean:
 	$(RM) *.o $(BINARIES) .depend

Modified: hugo/trunk/src/work/jacint/preflow.cc
==============================================================================
--- hugo/trunk/src/work/jacint/preflow.cc	(original)
+++ hugo/trunk/src/work/jacint/preflow.cc	Sat Mar 20 21:06:23 2004
@@ -1,6 +1,7 @@
 #include <iostream>
 #include <fstream>
 
+#include <smart_graph.h>
 #include <list_graph.h>
 #include <dimacs.h>
 #include <preflow.h>
@@ -11,12 +12,12 @@
 // Use a DIMACS max flow file as stdin.
 // read_dimacs_demo < dimacs_max_flow_file
 int main(int, char **) {
-  typedef ListGraph::Node Node;
-  typedef ListGraph::EdgeIt EdgeIt;
+  typedef SmartGraph::Node Node;
+  typedef SmartGraph::EdgeIt EdgeIt;
 
-  ListGraph G;
+  SmartGraph G;
   Node s, t;
-  ListGraph::EdgeMap<int> cap(G);
+  SmartGraph::EdgeMap<int> cap(G);
   readDimacsMaxFlow(std::cin, G, s, t, cap);
 
   std::cout << "preflow demo ..." << std::endl;
@@ -24,40 +25,40 @@
   double mintime=1000000;
 
   for ( int i=1; i!=11; ++i ) {
-    ListGraph::EdgeMap<int> flow(G);
+    SmartGraph::EdgeMap<int> flow(G);
     double pre_time=currTime();
-    Preflow<ListGraph, int> max_flow_test(G, s, t, cap, flow);
+    Preflow<SmartGraph, int> max_flow_test(G, s, t, cap, flow);
     max_flow_test.run();
     double post_time=currTime();
     if ( mintime > post_time-pre_time ) mintime = post_time-pre_time;
   }
 
-  ListGraph::EdgeMap<int> flow(G);
-  Preflow<ListGraph, int> max_flow_test(G, s, t, cap, flow);
+  SmartGraph::EdgeMap<int> flow(G);
+  Preflow<SmartGraph, int> max_flow_test(G, s, t, cap, flow);
   max_flow_test.run();
   
-  ListGraph::NodeMap<bool> cut(G);
+  SmartGraph::NodeMap<bool> cut(G);
   max_flow_test.minCut(cut); 
   int min_cut_value=0;
   EdgeIt e;
   for(G.first(e); G.valid(e); G.next(e)) {
-    if (cut.get(G.tail(e)) && !cut.get(G.head(e))) min_cut_value+=cap.get(e);
+    if (cut[G.tail(e)] && !cut[G.head(e)]) min_cut_value+=cap[e];
   }
 
-  ListGraph::NodeMap<bool> cut1(G);
+  SmartGraph::NodeMap<bool> cut1(G);
   max_flow_test.minMinCut(cut1); 
   int min_min_cut_value=0;
   for(G.first(e); G.valid(e); G.next(e)) {
-    if (cut.get(G.tail(e)) && !cut.get(G.head(e))) 
-      min_min_cut_value+=cap.get(e);
+    if (cut[G.tail(e)] && !cut[G.head(e)]) 
+      min_min_cut_value+=cap[e];
   }
 
-  ListGraph::NodeMap<bool> cut2(G);
+  SmartGraph::NodeMap<bool> cut2(G);
   max_flow_test.maxMinCut(cut2); 
   int max_min_cut_value=0;
   for(G.first(e); G.valid(e); G.next(e)) {
-    if (cut2.get(G.tail(e)) && !cut2.get(G.head(e))) 
-      max_min_cut_value+=cap.get(e);
+    if (cut2[G.tail(e)] && !cut2[G.head(e)]) 
+      max_min_cut_value+=cap[e];
       }
   
   std::cout << "min time of 10 runs: " << mintime << " sec"<< std::endl; 

Modified: hugo/trunk/src/work/jacint/prim.cc
==============================================================================
--- hugo/trunk/src/work/jacint/prim.cc	(original)
+++ hugo/trunk/src/work/jacint/prim.cc	Sat Mar 20 21:06:23 2004
@@ -1,6 +1,7 @@
 #include <iostream>
 #include <fstream>
 
+#include <smart_graph.h>
 #include <list_graph.h>
 #include <dimacs.h>
 #include <prim.h>
@@ -12,18 +13,18 @@
 using namespace hugo;
 
 int main(int, char **) {
-  typedef ListGraph::Node Node;
+  typedef SmartGraph::Node Node;
 
-  ListGraph G;
+  SmartGraph G;
   Node s, t;
-  ListGraph::EdgeMap<int> cap(G);
+  SmartGraph::EdgeMap<int> cap(G);
   readDimacsMaxFlow(std::cin, G, s, t, cap);
 
   std::cout << "prim demo ..." << std::endl;
   
   double pre_time=currTime();
-    Prim<ListGraph, int, FibHeap<ListGraph::Node, int, 
-    ListGraph::NodeMap<int> > > prim_test(G, cap);
+    Prim<SmartGraph, int, FibHeap<SmartGraph::Node, int, 
+    SmartGraph::NodeMap<int> > > prim_test(G, cap);
     prim_test.run();
   double post_time=currTime();
     
@@ -31,8 +32,8 @@
 	    << post_time-pre_time << " sec"<< std::endl; 
  
   pre_time=currTime();
-  Prim<ListGraph, int, BinHeap<ListGraph::Node, int, 
-    ListGraph::NodeMap<int> > > prim_test2(G, cap);
+  Prim<SmartGraph, int, BinHeap<SmartGraph::Node, int, 
+    SmartGraph::NodeMap<int> > > prim_test2(G, cap);
   prim_test2.run();
   post_time=currTime();
   



More information about the Lemon-commits mailing list