1.1 --- a/src/work/marci/bipartite_graph_wrapper.h Fri Apr 30 14:02:10 2004 +0000
1.2 +++ b/src/work/marci/bipartite_graph_wrapper.h Fri Apr 30 16:10:49 2004 +0000
1.3 @@ -26,10 +26,16 @@
1.4 ///\author Marton Makai
1.5 template<typename Graph>
1.6 class BipartiteGraphWrapper : public GraphWrapper<Graph> {
1.7 + protected:
1.8 typedef IterableBoolMap< typename Graph::template NodeMap<int> >
1.9 SFalseTTrueMap;
1.10 SFalseTTrueMap* s_false_t_true_map;
1.11
1.12 + BipartiteGraphWrapper() : GraphWrapper<Graph>(0) { }
1.13 + void setSFalseTTrueMap(SFalseTTrueMap& _s_false_t_true_map) {
1.14 + s_false_t_true_map=_s_false_t_true_map;
1.15 + }
1.16 +
1.17 public:
1.18 //marci
1.19 //FIXME vhogy igy kellene, csak az en forditom nem eszi meg
1.20 @@ -176,6 +182,45 @@
1.21 }
1.22 };
1.23
1.24 + ///\bug Do not use this while the bipartitemap augmentation
1.25 + /// does not work well.
1.26 + template<typename Graph>
1.27 + class BipartiteGraph : public BipartiteGraphWrapper<Graph> {
1.28 + typedef IterableBoolMap< typename Graph::template NodeMap<int> >
1.29 + SFalseTTrueMap;
1.30 + typedef BipartiteGraphWrapper<Graph> Parent;
1.31 + protected:
1.32 + Graph gr;
1.33 + typename Graph::template NodeMap<int> bipartite_map;
1.34 + SFalseTTrueMap s_false_t_true_map;
1.35 + public:
1.36 + typedef typename Parent::Node Node;
1.37 + typedef typename Parent::Edge Edge;
1.38 + BipartiteGraph() : BipartiteGraphWrapper<Graph>(0),
1.39 + gr(), bipartite_map(gr),
1.40 + s_false_t_true_map(bipartite_map) {
1.41 + Parent::setGraph(gr);
1.42 + Parent::setSFalseTTrueMap(bipartite_map);
1.43 + }
1.44 +
1.45 + /// the \c bool parameter which can be \c S_Class or \c T_Class shows
1.46 + /// the color class where the new node is to be inserted.
1.47 + void addNode(bool);
1.48 +
1.49 + /// A new edge is inserted.
1.50 + ///\pre \c tail have to be in \c S_Class and \c head in \c T_Class.
1.51 + void addEdge(const Node& tail, const Node& head);
1.52 +
1.53 + void erase(const Node&);
1.54 + void erase(const Edge&);
1.55 +
1.56 + void clear() {
1.57 + FOR_EACH_LOC(typename Parent::EdgeIt, e, G) erase(e);
1.58 + FOR_EACH_LOC(typename Parent::NodeIt, n, G) erase(n);
1.59 + }
1.60 + };
1.61 +
1.62 +
1.63 template<typename Graph>
1.64 class stGraphWrapper;
1.65
2.1 --- a/src/work/marci/graph_wrapper.h Fri Apr 30 14:02:10 2004 +0000
2.2 +++ b/src/work/marci/graph_wrapper.h Fri Apr 30 16:10:49 2004 +0000
2.3 @@ -88,14 +88,14 @@
2.4 class GraphWrapper {
2.5 protected:
2.6 Graph* graph;
2.7 -
2.8 + GraphWrapper() : graph(0) { }
2.9 + void setGraph(Graph& _graph) { graph=&_graph; }
2.10 +
2.11 public:
2.12 typedef Graph BaseGraph;
2.13 typedef Graph ParentGraph;
2.14
2.15 -// GraphWrapper() : graph(0) { }
2.16 GraphWrapper(Graph& _graph) : graph(&_graph) { }
2.17 -// void setGraph(Graph& _graph) { graph=&_graph; }
2.18 // Graph& getGraph() const { return *graph; }
2.19
2.20 // typedef typename Graph::Node Node;
2.21 @@ -225,8 +225,9 @@
2.22 ///\author Marton Makai
2.23 template<typename Graph>
2.24 class RevGraphWrapper : public GraphWrapper<Graph> {
2.25 + protected:
2.26 + RevGraphWrapper() : GraphWrapper<Graph>(0) { }
2.27 public:
2.28 -
2.29 RevGraphWrapper(Graph& _graph) : GraphWrapper<Graph>(_graph) { }
2.30
2.31 typedef typename GraphWrapper<Graph>::Node Node;
2.32 @@ -305,6 +306,16 @@
2.33 protected:
2.34 NodeFilterMap* node_filter_map;
2.35 EdgeFilterMap* edge_filter_map;
2.36 +
2.37 + SubGraphWrapper() : GraphWrapper<Graph>(0),
2.38 + node_filter_map(0), edge_filter_map(0) { }
2.39 + void setNodeFilterMap(NodeFilterMap& _node_filter_map) {
2.40 + node_filter_map=&_node_filte_map;
2.41 + }
2.42 + void setEdgeFilterMap(EdgeFilterMap& _edge_filter_map) {
2.43 + edge_filter_map=&_edge_filte_map;
2.44 + }
2.45 +
2.46 public:
2.47
2.48 SubGraphWrapper(Graph& _graph, NodeFilterMap& _node_filter_map,
2.49 @@ -453,6 +464,9 @@
2.50 /// the orientation of a directed one.
2.51 template<typename Graph>
2.52 class UndirGraphWrapper : public GraphWrapper<Graph> {
2.53 + protected:
2.54 + UndirGraphWrapper() : GraphWrapper<Graph>(0) { }
2.55 +
2.56 public:
2.57 typedef typename GraphWrapper<Graph>::Node Node;
2.58 typedef typename GraphWrapper<Graph>::NodeIt NodeIt;
2.59 @@ -536,6 +550,16 @@
2.60 protected:
2.61 const CapacityMap* capacity;
2.62 FlowMap* flow;
2.63 +
2.64 + ResGraphWrapper() : GraphWrapper<Graph>(0),
2.65 + capacity(0), flow(0) { }
2.66 + void setCapacityMap(const CapacityMap& _capacity_map) {
2.67 + capacity_map=&_capacity_map;
2.68 + }
2.69 + void setFlowMap(FlowMap& _flow) {
2.70 + flow=&_flow;
2.71 + }
2.72 +
2.73 public:
2.74
2.75 ResGraphWrapper(Graph& _graph, const CapacityMap& _capacity,