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

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


Author: marci
Date: Fri Apr 30 18:10:49 2004
New Revision: 657

Modified:
   hugo/trunk/src/work/marci/bipartite_graph_wrapper.h
   hugo/trunk/src/work/marci/graph_wrapper.h

Log:
bipartite graph in bipartite_graph_wrapper.h


Modified: hugo/trunk/src/work/marci/bipartite_graph_wrapper.h
==============================================================================
--- hugo/trunk/src/work/marci/bipartite_graph_wrapper.h	(original)
+++ hugo/trunk/src/work/marci/bipartite_graph_wrapper.h	Fri Apr 30 18:10:49 2004
@@ -26,10 +26,16 @@
   ///\author Marton Makai
   template<typename Graph> 
   class BipartiteGraphWrapper : public GraphWrapper<Graph> {
+  protected:
     typedef IterableBoolMap< typename Graph::template NodeMap<int> > 
     SFalseTTrueMap;
     SFalseTTrueMap* s_false_t_true_map;
 
+    BipartiteGraphWrapper() : GraphWrapper<Graph>(0) { }
+    void setSFalseTTrueMap(SFalseTTrueMap& _s_false_t_true_map) { 
+      s_false_t_true_map=_s_false_t_true_map;
+    }
+
   public:
     //marci
     //FIXME vhogy igy kellene, csak az en forditom nem eszi meg
@@ -176,6 +182,45 @@
     }
   };
 
+  ///\bug Do not use this while the bipartitemap augmentation 
+  /// does not work well.
+  template<typename Graph>
+  class BipartiteGraph : public BipartiteGraphWrapper<Graph> {
+    typedef IterableBoolMap< typename Graph::template NodeMap<int> > 
+    SFalseTTrueMap;
+    typedef BipartiteGraphWrapper<Graph> Parent;
+  protected:
+    Graph gr;
+    typename Graph::template NodeMap<int> bipartite_map;
+    SFalseTTrueMap s_false_t_true_map;
+  public:
+    typedef typename Parent::Node Node;
+    typedef typename Parent::Edge Edge;
+    BipartiteGraph() : BipartiteGraphWrapper<Graph>(0), 
+		       gr(), bipartite_map(gr), 
+		       s_false_t_true_map(bipartite_map) { 
+      Parent::setGraph(gr); 
+      Parent::setSFalseTTrueMap(bipartite_map);
+    }
+
+    /// the \c bool parameter which can be \c S_Class or \c T_Class shows 
+    /// the color class where the new node is to be inserted.
+    void addNode(bool);
+
+    /// A new edge is inserted.
+    ///\pre \c tail have to be in \c S_Class and \c head in \c T_Class.
+    void addEdge(const Node& tail, const Node& head);
+
+    void erase(const Node&);
+    void erase(const Edge&);
+    
+    void clear() {
+      FOR_EACH_LOC(typename Parent::EdgeIt, e, G) erase(e);
+      FOR_EACH_LOC(typename Parent::NodeIt, n, G) erase(n);
+    }
+  };
+
+
   template<typename Graph>
   class stGraphWrapper;
 

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	Fri Apr 30 18:10:49 2004
@@ -88,14 +88,14 @@
   class GraphWrapper {
   protected:
     Graph* graph;
-  
+    GraphWrapper() : graph(0) { }
+    void setGraph(Graph& _graph) { graph=&_graph; }
+
   public:
     typedef Graph BaseGraph;
     typedef Graph ParentGraph;
 
-//     GraphWrapper() : graph(0) { }
     GraphWrapper(Graph& _graph) : graph(&_graph) { }
-//     void setGraph(Graph& _graph) { graph=&_graph; }
 //     Graph& getGraph() const { return *graph; }
  
 //    typedef typename Graph::Node Node;
@@ -225,8 +225,9 @@
   ///\author Marton Makai
   template<typename Graph>
   class RevGraphWrapper : public GraphWrapper<Graph> {
+  protected:
+    RevGraphWrapper() : GraphWrapper<Graph>(0) { }
   public:
-
     RevGraphWrapper(Graph& _graph) : GraphWrapper<Graph>(_graph) { }  
 
     typedef typename GraphWrapper<Graph>::Node Node;
@@ -305,6 +306,16 @@
   protected:
     NodeFilterMap* node_filter_map;
     EdgeFilterMap* edge_filter_map;
+
+    SubGraphWrapper() : GraphWrapper<Graph>(0), 
+			node_filter_map(0), edge_filter_map(0) { }
+    void setNodeFilterMap(NodeFilterMap& _node_filter_map) {
+      node_filter_map=&_node_filte_map;
+    }
+    void setEdgeFilterMap(EdgeFilterMap& _edge_filter_map) {
+      edge_filter_map=&_edge_filte_map;
+    }
+    
   public:
 
     SubGraphWrapper(Graph& _graph, NodeFilterMap& _node_filter_map, 
@@ -453,6 +464,9 @@
   /// the orientation of a directed one.
   template<typename Graph>
   class UndirGraphWrapper : public GraphWrapper<Graph> {
+  protected:
+    UndirGraphWrapper() : GraphWrapper<Graph>(0) { }
+    
   public:
     typedef typename GraphWrapper<Graph>::Node Node;
     typedef typename GraphWrapper<Graph>::NodeIt NodeIt;
@@ -536,6 +550,16 @@
   protected:
     const CapacityMap* capacity;
     FlowMap* flow;
+
+    ResGraphWrapper() : GraphWrapper<Graph>(0), 
+			capacity(0), flow(0) { }
+    void setCapacityMap(const CapacityMap& _capacity_map) {
+      capacity_map=&_capacity_map;
+    }
+    void setFlowMap(FlowMap& _flow) {
+      flow=&_flow;
+    }
+
   public:
 
     ResGraphWrapper(Graph& _graph, const CapacityMap& _capacity, 



More information about the Lemon-commits mailing list