# HG changeset patch # User marci # Date 1083341449 0 # Node ID 500456d50d21881dda8323b3f2d3941bf7254067 # Parent 7c463a7635d49c8b92f1c7e9922ef4a9b500726a bipartite graph in bipartite_graph_wrapper.h diff -r 7c463a7635d4 -r 500456d50d21 src/work/marci/bipartite_graph_wrapper.h --- a/src/work/marci/bipartite_graph_wrapper.h Fri Apr 30 14:02:10 2004 +0000 +++ b/src/work/marci/bipartite_graph_wrapper.h Fri Apr 30 16:10:49 2004 +0000 @@ -26,10 +26,16 @@ ///\author Marton Makai template class BipartiteGraphWrapper : public GraphWrapper { + protected: typedef IterableBoolMap< typename Graph::template NodeMap > SFalseTTrueMap; SFalseTTrueMap* s_false_t_true_map; + BipartiteGraphWrapper() : GraphWrapper(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 + class BipartiteGraph : public BipartiteGraphWrapper { + typedef IterableBoolMap< typename Graph::template NodeMap > + SFalseTTrueMap; + typedef BipartiteGraphWrapper Parent; + protected: + Graph gr; + typename Graph::template NodeMap bipartite_map; + SFalseTTrueMap s_false_t_true_map; + public: + typedef typename Parent::Node Node; + typedef typename Parent::Edge Edge; + BipartiteGraph() : BipartiteGraphWrapper(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 class stGraphWrapper; diff -r 7c463a7635d4 -r 500456d50d21 src/work/marci/graph_wrapper.h --- a/src/work/marci/graph_wrapper.h Fri Apr 30 14:02:10 2004 +0000 +++ b/src/work/marci/graph_wrapper.h Fri Apr 30 16:10:49 2004 +0000 @@ -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 class RevGraphWrapper : public GraphWrapper { + protected: + RevGraphWrapper() : GraphWrapper(0) { } public: - RevGraphWrapper(Graph& _graph) : GraphWrapper(_graph) { } typedef typename GraphWrapper::Node Node; @@ -305,6 +306,16 @@ protected: NodeFilterMap* node_filter_map; EdgeFilterMap* edge_filter_map; + + SubGraphWrapper() : GraphWrapper(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 class UndirGraphWrapper : public GraphWrapper { + protected: + UndirGraphWrapper() : GraphWrapper(0) { } + public: typedef typename GraphWrapper::Node Node; typedef typename GraphWrapper::NodeIt NodeIt; @@ -536,6 +550,16 @@ protected: const CapacityMap* capacity; FlowMap* flow; + + ResGraphWrapper() : GraphWrapper(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,