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

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


Author: marci
Date: Thu Feb  5 16:06:45 2004
New Revision: 79

Modified:
   hugo/trunk/src/work/bfs_iterator.hh
   hugo/trunk/src/work/edmonds_karp.hh
   hugo/trunk/src/work/list_graph.hh

Log:
.


Modified: hugo/trunk/src/work/bfs_iterator.hh
==============================================================================
--- hugo/trunk/src/work/bfs_iterator.hh	(original)
+++ hugo/trunk/src/work/bfs_iterator.hh	Thu Feb  5 16:06:45 2004
@@ -405,7 +405,7 @@
     OutEdgeIt actual_edge;
   public:
     BfsIterator2(const Graph& _G) : G(_G), reached(G, false) { }
-    void pushAndSetReached(const NodeIt s) { 
+    void pushAndSetReached(NodeIt s) { 
       reached.set(s, true);
       if (bfs_queue.empty()) {
 	bfs_queue.push(G.template first<OutEdgeIt>(s));
@@ -444,17 +444,15 @@
 	bfs_queue.pop(); 
 	if (!bfs_queue.empty()) {
 	  actual_edge=bfs_queue.front();
-	} else {
-	  actual_edge=OutEdgeIt();
-	}
-	if (actual_edge.valid()) {
-	  NodeIt w=G.bNode(actual_edge);
-	  if (!reached.get(w)) {
-	    bfs_queue.push(G.template first<OutEdgeIt>(w));
-	    reached.set(w, true);
-	    b_node_newly_reached=true;
-	  } else {
-	    b_node_newly_reached=false;
+	  if (actual_edge.valid()) {
+	    NodeIt w=G.bNode(actual_edge);
+	    if (!reached.get(w)) {
+	      bfs_queue.push(G.template first<OutEdgeIt>(w));
+	      reached.set(w, true);
+	      b_node_newly_reached=true;
+	    } else {
+	      b_node_newly_reached=false;
+	    }
 	  }
 	}
       }
@@ -468,7 +466,6 @@
     const std::queue<OutEdgeIt>& getBfsQueue() const { return bfs_queue; }
  };
 
-
 } // namespace marci
 
 #endif //BFS_ITERATOR_HH

Modified: hugo/trunk/src/work/edmonds_karp.hh
==============================================================================
--- hugo/trunk/src/work/edmonds_karp.hh	(original)
+++ hugo/trunk/src/work/edmonds_karp.hh	Thu Feb  5 16:06:45 2004
@@ -41,7 +41,7 @@
 	}
       }
       bool valid() const { return sym.valid(); }
-      void augment(const T a) const {
+      void augment(T a) const {
 	if (resG->G.aNode(sym)==resG->G.tail(sym)) { 
 	  resG->flow.set(sym, resG->flow.get(sym)+a);
 	} else { 
@@ -56,7 +56,7 @@
       OutEdgeIt() { }
       //OutEdgeIt(const OutEdgeIt& e) { resG=e.resG; sym=e.sym; }
     private:
-      OutEdgeIt(const ResGraph<Graph, T, FlowMap, CapacityMap>& _resG, const NodeIt v) { 
+      OutEdgeIt(const ResGraph<Graph, T, FlowMap, CapacityMap>& _resG, NodeIt v) { 
       	resG=&_resG;
 	sym=resG->G.template first<OldSymEdgeIt>(v);
 	while( sym.valid() && !(free()>0) ) { ++sym; }
@@ -69,7 +69,7 @@
       }
     };
 
-    void getFirst(OutEdgeIt& e, const NodeIt v) const { 
+    void getFirst(OutEdgeIt& e, NodeIt v) const { 
       e=OutEdgeIt(*this, v); 
     }
     void getFirst(EachNodeIt& v) const { G.getFirst(v); }
@@ -82,28 +82,28 @@
     }
 
     template< typename It >
-    It first(const NodeIt v) const { 
+    It first(NodeIt v) const { 
       It e;
       getFirst(e, v);
       return e; 
     }
 
-    NodeIt tail(const EdgeIt e) const { return G.aNode(e.sym); }
-    NodeIt head(const EdgeIt e) const { return G.bNode(e.sym); }
+    NodeIt tail(EdgeIt e) const { return G.aNode(e.sym); }
+    NodeIt head(EdgeIt e) const { return G.bNode(e.sym); }
 
-    NodeIt aNode(const OutEdgeIt e) const { return G.aNode(e.sym); }
-    NodeIt bNode(const OutEdgeIt e) const { return G.bNode(e.sym); }
+    NodeIt aNode(OutEdgeIt e) const { return G.aNode(e.sym); }
+    NodeIt bNode(OutEdgeIt e) const { return G.bNode(e.sym); }
 
-    int id(const NodeIt v) const { return G.id(v); }
+    int id(NodeIt v) const { return G.id(v); }
 
     template <typename ValueType>
     class NodeMap {
       typename Graph::NodeMap<ValueType> node_map; 
     public:
       NodeMap(const ResGraph<Graph, T, FlowMap, CapacityMap>& _G) : node_map(_G.G) { }
-      NodeMap(const ResGraph<Graph, T, FlowMap, CapacityMap>& _G, const ValueType a) : node_map(_G.G, a) { }
-      void set(const NodeIt nit, const ValueType a) { node_map.set(nit, a); }
-      ValueType get(const NodeIt nit) const { return node_map.get(nit); }
+      NodeMap(const ResGraph<Graph, T, FlowMap, CapacityMap>& _G, ValueType a) : node_map(_G.G, a) { }
+      void set(NodeIt nit, ValueType a) { node_map.set(nit, a); }
+      ValueType get(NodeIt nit) const { return node_map.get(nit); }
     };
 
   };
@@ -116,15 +116,15 @@
     typedef typename Graph::OutEdgeIt OutEdgeIt;
     typedef typename Graph::InEdgeIt InEdgeIt;
     const Graph& G;
-    const NodeIt s;
-    const NodeIt t;
+    NodeIt s;
+    NodeIt t;
     FlowMap& flow;
     const CapacityMap& capacity;
     typedef ResGraph<Graph, T, FlowMap, CapacityMap > AugGraph;
     typedef typename AugGraph::OutEdgeIt AugOutEdgeIt;
     typedef typename AugGraph::EdgeIt AugEdgeIt;
   public:
-    MaxFlow(const Graph& _G, const NodeIt _s, const NodeIt _t, FlowMap& _flow, const CapacityMap& _capacity) : G(_G), s(_s), t(_t), flow(_flow), capacity(_capacity) { }
+    MaxFlow(const Graph& _G, NodeIt _s, NodeIt _t, FlowMap& _flow, const CapacityMap& _capacity) : G(_G), s(_s), t(_t), flow(_flow), capacity(_capacity) { }
     bool augment() {
       AugGraph res_graph(G, flow, capacity);
       bool _augment=false;

Modified: hugo/trunk/src/work/list_graph.hh
==============================================================================
--- hugo/trunk/src/work/list_graph.hh	(original)
+++ hugo/trunk/src/work/list_graph.hh	Thu Feb  5 16:06:45 2004
@@ -40,10 +40,10 @@
       std::vector<ValueType> container;
     public:
       NodeMap(const ListGraph& _G) : G(_G), container(_G.node_id) { }
-      NodeMap(const ListGraph& _G, const ValueType a) : 
+      NodeMap(const ListGraph& _G, ValueType a) : 
 	G(_G), container(_G.node_id, a) { }
-      void set(const NodeIt nit, const ValueType a) { container[G.id(nit)]=a; }
-      ValueType get(const NodeIt nit) const { return container[G.id(nit)]; }
+      void set(NodeIt nit, ValueType a) { container[G.id(nit)]=a; }
+      ValueType get(NodeIt nit) const { return container[G.id(nit)]; }
     };
 
     template <typename ValueType>
@@ -52,10 +52,10 @@
       std::vector<ValueType> container;
     public:
       EdgeMap(const ListGraph& _G) : G(_G), container(_G.edge_id) { }
-      EdgeMap(const ListGraph& _G, const ValueType a) : 
+      EdgeMap(const ListGraph& _G, ValueType a) : 
 	G(_G), container(_G.edge_id, a) { }
-      void set(const EdgeIt eit, const ValueType a) { container[G.id(eit)]=a; }
-      ValueType get(const EdgeIt eit) const { return container[G.id(eit)]; }
+      void set(EdgeIt eit, ValueType a) { container[G.id(eit)]=a; }
+      ValueType get(EdgeIt eit) const { return container[G.id(eit)]; }
     };
 
     int node_id;
@@ -226,8 +226,8 @@
     //OutEdgeIt firstOutEdge(const NodeIt v) const { return OutEdgeIt(v); }
     //InEdgeIt firstInEdge(const NodeIt v) const { return InEdgeIt(v); }
     //SymEdgeIt firstSymEdge(const NodeIt v) const { return SymEdgeIt(v); }
-    NodeIt tail(const EdgeIt e) const { return e.tailNode(); }
-    NodeIt head(const EdgeIt e) const { return e.headNode(); }
+    NodeIt tail(EdgeIt e) const { return e.tailNode(); }
+    NodeIt head(EdgeIt e) const { return e.headNode(); }
 
     NodeIt aNode(const OutEdgeIt& e) const { return e.aNode(); }
     NodeIt aNode(const InEdgeIt& e) const { return e.aNode(); }
@@ -248,18 +248,18 @@
 
     void getFirst(EachNodeIt& v) const { v=EachNodeIt(*this); }
     void getFirst(EachEdgeIt& e) const { e=EachEdgeIt(*this); }
-    void getFirst(OutEdgeIt& e, const NodeIt& v) const { e=OutEdgeIt(v); }
-    void getFirst(InEdgeIt& e, const NodeIt& v) const { e=InEdgeIt(v); }
-    void getFirst(SymEdgeIt& e, const NodeIt& v) const { e=SymEdgeIt(v); }
-    void getTail(NodeIt& n, const EdgeIt& e) const { n=tail(e); }
-    void getHead(NodeIt& n, const EdgeIt& e) const { n=head(e); }
-
-    void getANode(NodeIt& n, const OutEdgeIt& e) const { n=e.aNode(); }
-    void getANode(NodeIt& n, const InEdgeIt& e) const { n=e.aNode(); }
-    void getANode(NodeIt& n, const SymEdgeIt& e) const { n=e.aNode(); }
-    void getBNode(NodeIt& n, const OutEdgeIt& e) const { n=e.bNode(); }
-    void getBNode(NodeIt& n, const InEdgeIt& e) const { n=e.bNode(); }
-    void getBNode(NodeIt& n, const SymEdgeIt& e) const { n=e.bNode(); }
+    void getFirst(OutEdgeIt& e, NodeIt v) const { e=OutEdgeIt(v); }
+    void getFirst(InEdgeIt& e, NodeIt v) const { e=InEdgeIt(v); }
+    void getFirst(SymEdgeIt& e, NodeIt v) const { e=SymEdgeIt(v); }
+    //void getTail(NodeIt& n, const EdgeIt& e) const { n=tail(e); }
+    //void getHead(NodeIt& n, const EdgeIt& e) const { n=head(e); }
+
+    //void getANode(NodeIt& n, const OutEdgeIt& e) const { n=e.aNode(); }
+    //void getANode(NodeIt& n, const InEdgeIt& e) const { n=e.aNode(); }
+    //void getANode(NodeIt& n, const SymEdgeIt& e) const { n=e.aNode(); }
+    //void getBNode(NodeIt& n, const OutEdgeIt& e) const { n=e.bNode(); }
+    //void getBNode(NodeIt& n, const InEdgeIt& e) const { n=e.bNode(); }
+    //void getBNode(NodeIt& n, const SymEdgeIt& e) const { n=e.bNode(); }
     //void get_invalid(NodeIt& n) { n=NodeIt(); }
     //void get_invalid(EdgeIt& e) { e=EdgeIt(); }
     //void get_invalid(OutEdgeIt& e) { e=OutEdgeIt(); }
@@ -274,7 +274,7 @@
     }
 
     template< typename It >
-    It first(const NodeIt v) const { 
+    It first(NodeIt v) const { 
       It e;
       getFirst(e, v);
       return e; 
@@ -283,29 +283,29 @@
     /* for getting id's of graph objects */
     /* these are important for the implementation of property vectors */
 
-    int id(const NodeIt v) const { return v.node->id; }
-    int id(const EdgeIt e) const { return e.edge->id; }
+    int id(NodeIt v) const { return v.node->id; }
+    int id(EdgeIt e) const { return e.edge->id; }
 
     /* adding nodes and edges */
 
     NodeIt addNode() { return NodeIt(_add_node()); }
-    EdgeIt addEdge(const NodeIt u, const NodeIt v) {
+    EdgeIt addEdge(NodeIt u, NodeIt v) {
       return EdgeIt(_add_edge(u.node, v.node)); 
     }
 
-    void deleteNode(const NodeIt i) { 
+    void deleteNode(NodeIt i) { 
       while (first<OutEdgeIt>(i).valid()) deleteEdge(first<OutEdgeIt>(i));
       while (first<InEdgeIt>(i).valid()) deleteEdge(first<InEdgeIt>(i));
       _delete_node(i.node); 
     }
   
-    void deleteEdge(const EdgeIt e) { _delete_edge(e.edge); }
+    void deleteEdge(EdgeIt e) { _delete_edge(e.edge); }
 
-    void setTail(const EdgeIt e, const NodeIt tail) {
+    void setTail(EdgeIt e, NodeIt tail) {
       _set_tail(e.edge, tail.node); 
     }
 
-    void setHead(const EdgeIt e, const NodeIt head) {
+    void setHead(EdgeIt e, NodeIt head) {
       _set_head(e.edge, head.node); 
     }
 
@@ -328,7 +328,7 @@
       friend class SymEdgeIt;
     protected:
       node_item* node;
-      friend int ListGraph::id(const NodeIt v) const; 
+      friend int ListGraph::id(NodeIt v) const; 
     public:
       NodeIt() : node(0) { }
       NodeIt(node_item* _node) : node(_node) { }
@@ -360,7 +360,7 @@
       friend class EachNodeIt;
     protected:
       edge_item* edge;
-      friend int ListGraph::id(const EdgeIt e) const;
+      friend int ListGraph::id(EdgeIt e) const;
     public:
       EdgeIt() : edge(0) { }
       //EdgeIt() { }
@@ -406,7 +406,7 @@
       OutEdgeIt(const NodeIt& _v) : v(_v.node) { edge=v->_first_out_edge; }
     public:
       OutEdgeIt() : EdgeIt(), v(0) { }
-      OutEdgeIt(const ListGraph& G, const NodeIt _v) : v(_v.node) { edge=v->_first_out_edge; }
+      OutEdgeIt(const ListGraph& G, NodeIt _v) : v(_v.node) { edge=v->_first_out_edge; }
       OutEdgeIt& operator++() { edge=edge->_next_out; return *this; }
     protected:
       NodeIt aNode() const { return NodeIt(v); }
@@ -421,7 +421,7 @@
       InEdgeIt(const NodeIt& _v) : v(_v.node) { edge=v->_first_in_edge; }
     public:
       InEdgeIt() : EdgeIt(), v(0) { }
-      InEdgeIt(const ListGraph& G, const NodeIt _v) : v(_v.node) { edge=v->_first_in_edge; }
+      InEdgeIt(const ListGraph& G, NodeIt _v) : v(_v.node) { edge=v->_first_in_edge; }
       InEdgeIt& operator++() { edge=edge->_next_in; return *this; }
     protected:
       NodeIt aNode() const { return NodeIt(v); }
@@ -441,7 +441,7 @@
       }
     public:
       SymEdgeIt() : EdgeIt(), v(0) { }
-      SymEdgeIt(const ListGraph& G, const NodeIt _v) : v(_v.node) { 
+      SymEdgeIt(const ListGraph& G, NodeIt _v) : v(_v.node) { 
 	out_or_in=1;
 	edge=v->_first_out_edge; 
 	if (!edge) { edge=v->_first_in_edge; out_or_in=0; }



More information about the Lemon-commits mailing list