Collaboration diagram for Wrapper Classes for Graphs:
![]() |
g
of a directed graph type say ListGraph
and an algorithm template<typename Graph> int algorithm(const Graph&);
g
with the reverse orientation. Thus, a wrapper class template<typename Graph> class RevGraphWrapper;
ListGraph g;
RevGraphWrapper<ListGraph> rgw(g);
int result=algorithm(rgw);
g
remains untouched. Thus the graph wrapper used above is to consider the original graph with reverse orientation. This techniques gives rise to an elegant code, and based on stable graph wrappers, complex algorithms can be implemented easily. In flow, circulation and bipartite matching problems, the residual graph is of particular importance. Combining a wrapper implementing this, shortest path algorithms and minimum mean cycle algorithms, a range of weighted and cardinality optimization algorithms can be obtained. For lack of space, for other examples, the interested user is referred to the detailed documentation of graph wrappers. The behavior of graph wrappers can be very different. Some of them keep capabilities of the original graph while in other cases this would be meaningless. This means that the concepts that they are a model of depend on the graph wrapper, and the wrapped graph(s). If an edge of rgw
is deleted, this is carried out by deleting the corresponding edge of g
. But for a residual graph, this operation has no sense. Let we stand one more example here to simplify your work. wrapper class template<typename Graph> class RevGraphWrapper;
RevGraphWrapper(Graph& _g)
. This means that in a situation, when a const ListGraph&
reference to a graph is given, then it have to be instantiated with Graph=const ListGraph
. int algorithm1(const ListGraph& g) { RevGraphWrapper<const ListGraph> rgw(g); return algorithm2(rgw); }
gwrappers
Base type for the Graph Wrappers
Files | |
file | graph_wrapper.h |
Several graph wrappers. | |
Classes | |
class | RevGraphWrapper |
A graph wrapper which reverses the orientation of the edges. More... | |
class | SubGraphWrapper |
A graph wrapper for hiding nodes and edges from a graph. More... | |
class | NodeSubGraphWrapper |
A wrapper for hiding nodes from a graph. More... | |
class | EdgeSubGraphWrapper |
A wrapper for hiding edges from a graph. More... | |
class | SubBidirGraphWrapper |
A wrapper for composing a subgraph of a bidirected graph made from a directed one. More... | |
class | BidirGraphWrapper |
A wrapper for composing bidirected graph from a directed one. More... | |
class | ResGraphWrapper |
A wrapper for composing the residual graph for directed flow and circulation problems. More... | |
class | ErasingFirstGraphWrapper |
For blocking flows. More... |