[Lemon-commits] [lemon_svn] marci: r524 - in hugo/trunk/src/work: . marci

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


Author: marci
Date: Sat Apr 24 17:19:17 2004
New Revision: 524

Modified:
   hugo/trunk/src/work/makefile
   hugo/trunk/src/work/marci/bipartite_graph_wrapper_test.cc
   hugo/trunk/src/work/marci/graph_wrapper.h

Log:
misc


Modified: hugo/trunk/src/work/makefile
==============================================================================
--- hugo/trunk/src/work/makefile	(original)
+++ hugo/trunk/src/work/makefile	Sat Apr 24 17:19:17 2004
@@ -1,12 +1,12 @@
 INCLUDEDIRS ?= -I../include -I. -I./{marci,jacint,alpar,klao,akos}
-CXXFLAGS = -g -O3 -W -Wall $(INCLUDEDIRS) -ansi -pedantic
+CXXFLAGS = -g -O0 -W -Wall $(INCLUDEDIRS) -ansi -pedantic
 
 BINARIES ?= bin_heap_demo
 
 # Hat, ez elismerem, hogy nagyon ronda, de mukodik minden altalam
 # ismert rendszeren :-)  (Misi)
-CXX := $(shell type -p g++-3.4 || type -p g++-3.3 || type -p g++-3.2 || type -p g++-3.0 || type -p g++-3 || echo g++)
-#CXX := $(shell type -p g++-3.3 || type -p g++-3.2 || type -p g++-3.0 || type -p g++-3 || echo g++)
+#CXX := $(shell type -p g++-3.4 || type -p g++-3.3 || type -p g++-3.2 || type -p g++-3.0 || type -p g++-3 || echo g++)
+CXX := $(shell type -p g++-3.3 || type -p g++-3.2 || type -p g++-3.0 || type -p g++-3 || echo g++)
 CC := $(CXX)
 
 

Modified: hugo/trunk/src/work/marci/bipartite_graph_wrapper_test.cc
==============================================================================
--- hugo/trunk/src/work/marci/bipartite_graph_wrapper_test.cc	(original)
+++ hugo/trunk/src/work/marci/bipartite_graph_wrapper_test.cc	Sat Apr 24 17:19:17 2004
@@ -72,6 +72,9 @@
   MaxFlow<stGW, int, ConstMap<stGW::Edge, int>, stGW::EdgeMap<int> > 
     max_flow_test(stgw, stgw.S_NODE, stgw.T_NODE, const1map, flow);
   max_flow_test.augmentOnShortestPath();
+  max_flow_test.augmentOnShortestPath();
+
+  std::cout << max_flow_test.flowValue() << std::endl;
 
   return 0;
 }

Modified: hugo/trunk/src/work/marci/graph_wrapper.h
==============================================================================
--- hugo/trunk/src/work/marci/graph_wrapper.h	(original)
+++ hugo/trunk/src/work/marci/graph_wrapper.h	Sat Apr 24 17:19:17 2004
@@ -918,7 +918,7 @@
     typedef IterableBoolMap< typename Graph::template NodeMap<int> > 
     SFalseTTrueMap;
     SFalseTTrueMap* s_false_t_true_map;
-    
+
   public:
     static const bool S_CLASS=false;
     static const bool T_CLASS=true;
@@ -930,7 +930,15 @@
     //using GraphWrapper<Graph>::NodeIt;
     typedef typename GraphWrapper<Graph>::Edge Edge;
     //using GraphWrapper<Graph>::EdgeIt;
+    class ClassNodeIt;
+    friend class ClassNodeIt;
+    class OutEdgeIt;
+    friend class OutEdgeIt;
+    class InEdgeIt;
+    friend class InEdgeIt;
     class ClassNodeIt {
+      friend class BipartiteGraphWrapper<Graph>;
+    protected:
       Node n;
     public:
       ClassNodeIt() { }
@@ -963,8 +971,8 @@
 //       operator Node() const { return n; }
 //     };
     class OutEdgeIt { 
-    public:
-
+      friend class BipartiteGraphWrapper<Graph>;
+    protected:
       typename Graph::OutEdgeIt e;
     public:
       OutEdgeIt() { }
@@ -978,7 +986,8 @@
       operator Edge() const { return Edge(typename Graph::Edge(e)); }
     };
     class InEdgeIt { 
-    public:
+      friend class BipartiteGraphWrapper<Graph>;
+    protected:
       typename Graph::InEdgeIt e;
     public:
       InEdgeIt() { }
@@ -994,7 +1003,7 @@
 
     using GraphWrapper<Graph>::first;
     ClassNodeIt& first(ClassNodeIt& n, bool _class) const { 
-      n=SNodeIt(*this, _class) ; return n; }
+      n=ClassNodeIt(*this, _class) ; return n; }
 //    SNodeIt& first(SNodeIt& n) const { n=SNodeIt(*this); return n; }
 //    TNodeIt& first(TNodeIt& n) const { n=TNodeIt(*this); return n; }
     OutEdgeIt& first(OutEdgeIt& i, const Node& p) const { 
@@ -1006,7 +1015,7 @@
 
     using GraphWrapper<Graph>::next;
     ClassNodeIt& next(ClassNodeIt& n) const { 
-      this->s_false_t_true_map->next(n); return n; 
+      this->s_false_t_true_map->next(n.n); return n; 
     }
 //     SNodeIt& next(SNodeIt& n) const { 
 //       this->s_false_t_true_map->next(n); return n; 
@@ -1319,9 +1328,10 @@
       return i; 
     }
     OutEdgeIt& next(OutEdgeIt& i) const { 
+      typename Graph::Node v;
       switch (i.spec) {
 	case 0: //normal edge
-	  typename Graph::Node v=this->graph->aNode(i.e);
+	  this->graph->aNode(i.e);
 	  this->graph->next(i.e);
 	  if (!this->graph->valid(i.e)) { //Az igazi elek vegere ertunk
 	    if (this->graph->inSClass(v)) { //S, nincs kiel
@@ -1345,9 +1355,10 @@
       return i; 
     }
     InEdgeIt& next(InEdgeIt& i) const { 
+      typename Graph::Node v;
       switch (i.spec) {
 	case 0: //normal edge
-	  typename Graph::Node v=this->graph->aNode(i.e);
+	  v=this->graph->aNode(i.e);
 	  this->graph->next(i.e);
 	  if (!this->graph->valid(i.e)) { //Az igazi elek vegere ertunk
 	    if (this->graph->inTClass(v)) { //S, nincs beel
@@ -1403,28 +1414,30 @@
 
     Node tail(const Edge& e) const { 
       switch (e.spec) {
-	case 0: 
-	  return Node(this->graph->tail(e));
-	  break;
-	case 1:
-	  return S_NODE;
-	  break;
-	case 2:
-	  return Node(e.n);
-	  break;
+      case 0: 
+	return Node(this->graph->tail(e));
+	break;
+      case 1:
+	return S_NODE;
+	break;
+      case 2:
+      default:
+	return Node(e.n);
+	break;
       }
     }
     Node head(const Edge& e) const { 
       switch (e.spec) {
-	case 0: 
-	  return Node(this->graph->head(e));
-	  break;
-	case 1:
-	  return Node(e.n);
-	  break;
-	case 2:
-	  return T_NODE;
-	  break;
+      case 0: 
+	return Node(this->graph->head(e));
+	break;
+      case 1:
+	return Node(e.n);
+	break;
+      case 2:
+      default:
+	return T_NODE;
+	break;
       }
     }
 
@@ -1458,64 +1471,68 @@
 						      t_value(a) { }
       T operator[](const Node& n) const { 
 	switch (n.spec) {
-	  case 0: 
-	    return (*this)[n];
-	    break;
-	  case 1:
-	    return s_value;
-	    break;
-	  case 2:
-	    return t_value;
-	    break;
+	case 0: 
+	  return Parent::operator[](n);
+	  break;
+	case 1:
+	  return s_value;
+	  break;
+	case 2: 
+	default:
+	  return t_value;
+	  break;
 	}
       }
       void set(const Node& n, T t) { 
 	switch (n.spec) {
-	  case 0: 
-	    GraphWrapper<Graph>::template NodeMap<T>::set(n, t);
-	    break;
-	  case 1:
-	    s_value=t;
-	    break;
-	  case 2:
-	    t_value=t;
-	    break;
+	case 0: 
+	  GraphWrapper<Graph>::template NodeMap<T>::set(n, t);
+	  break;
+	case 1:
+	  s_value=t;
+	  break;
+	case 2:
+	default:
+	  t_value=t;
+	  break;
 	}
       }
     };
 
     template<typename T> class EdgeMap : public GraphWrapper<Graph>::template EdgeMap<T> { 
-      typedef typename Graph::template NodeMap<T> Parent;
+      typedef typename GraphWrapper<Graph>::template EdgeMap<T> Parent;
       typename GraphWrapper<Graph>::template NodeMap<T> node_value;
     public:
-      EdgeMap(const stGraphWrapper<Graph>& _G) :  Parent(_G), 
-						  node_value(_G) { }
+      EdgeMap(const stGraphWrapper<Graph>& _G) : Parent(_G), 
+						 node_value(_G) { }
       EdgeMap(const stGraphWrapper<Graph>& _G, T a) : Parent(_G, a), 
 						      node_value(_G, a) { }
       T operator[](const Edge& e) const { 
 	switch (e.spec) {
-	  case 0: 
-	    return (*this)[e];
-	    break;
-	  case 1:
-	    return node_value[e.n];
-	    break;
-	  case 2:
-	    return node_value[e.n];
-	    break;
+	case 0: 
+	  return Parent::operator[](e);
+	  break;
+	case 1:
+	  return node_value[e.n];
+	  break;
+	case 2:
+	default:
+	  return node_value[e.n];
+	  break;
 	}
       }
       void set(const Edge& e, T t) { 
 	switch (e.spec) {
-	  case 0: 
-	    GraphWrapper<Graph>::set(e, t);
-	    break;
-	  case 1:
-	    node_value.set(e, t);
-	    break;
-	  case 2:
-	    node_value.set(e, t);
-	    break;
+	case 0: 
+	  GraphWrapper<Graph>::template EdgeMap<T>::set(e, t);
+	  break;
+	case 1:
+	  node_value.set(e.n, t);
+	  break;
+	case 2:
+	default:
+	  node_value.set(e.n, t);
+	  break;
 	}
       }
     };



More information about the Lemon-commits mailing list