Adaptor Classes for Graphs
The same group on the Doxygen site.
- group Adaptor Classes for Graphs
Adaptor classes for digraphs and graphs.
This group contains several useful adaptor classes for digraphs and graphs.
The main parts of LEMON are the different graph structures, generic graph algorithms, graph concepts, which couple them, and graph adaptors. While the previous notions are more or less clear, the latter one needs further explanation. Graph adaptors are graph classes which serve for considering graph structures in different ways.
A short example makes this much clearer. Suppose that we have an instance
gof a directed graph type, say ListDigraph and an algorithmis needed to run on the reverse oriented graph. It may be expensive (in time or in memory usage) to copytemplate< typename Digraph > int algorithm( const Digraph & );
gwith the reversed arcs. In this case, an adaptor class is used, which (according to LEMON digraph concepts) works as a digraph. The adaptor uses the original digraph structure and digraph operations when methods of the reversed oriented graph are called. This means that the adaptor have minor memory usage, and do not perform sophisticated algorithmic actions. The purpose of it is to give a tool for the cases when a graph have to be used in a specific alteration. If this alteration is obtained by a usual construction like filtering the node or the arc set or considering a new orientation, then an adaptor is worthwhile to use. To come back to the reverse oriented graph, in this situationtemplate class can be used. The code looks as followstemplate< typename Digraph > class ReverseDigraph;
During running the algorithm, the original digraphListDigraph g; ReverseDigraph< ListDigraph > rg( g ); int result = algorithm( rg );
gis untouched. This techniques give rise to an elegant code, and based on stable graph adaptors, complex algorithms can be implemented easily.In flow, circulation and matching problems, the residual graph is of particular importance. Combining an adaptor implementing this with shortest path algorithms or minimum mean cycle algorithms, a range of weighted and cardinality optimization algorithms can be obtained. For other examples, the interested user is referred to the detailed documentation of particular adaptors.
Since the adaptor classes conform to the graph concepts, an adaptor can even be applied to another one. The following image illustrates a situation when a SubDigraph adaptor is applied on a digraph and Undirector is applied on the subgraph.

The behavior of graph adaptors 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 meet depend on the graph adaptor, and the wrapped graph. For example, if an arc of a reversed digraph is deleted, this is carried out by deleting the corresponding arc of the original digraph, thus the adaptor modifies the original digraph. However in case of a residual digraph, this operation has no sense.
Let us stand one more example here to simplify your work. ReverseDigraph has constructor
This means that in a situation, when aReverseDigraph( Digraph & digraph );
const ListDigraph&reference to a graph is given, then it have to be instantiated withDigraph=const ListDigraph.int algorithm1( const ListDigraph & g ) { ReverseDigraph< const ListDigraph > rg( g ); return( algorithm2( rg ) ); }
Classes
Class |
Description |
|---|---|
Adaptor class for reversing the orientation of the arcs in a digraph. |
|
Adaptor class for hiding nodes and arcs in a digraph. |
|
Adaptor class for hiding nodes and edges in an undirected graph. |
|
Adaptor class for hiding nodes in a digraph or a graph. |
|
Adaptor class for hiding arcs in a digraph. |
|
Adaptor class for hiding edges in a graph. |
|
Adaptor class for viewing a digraph as an undirected graph. |
|
Adaptor class for orienting the edges of a graph to get a digraph. |
|
Adaptor class for composing the residual digraph for directed flow and circulation problems. |
|
Adaptor class for splitting the nodes of a digraph. |
Other classes of its headers
Class |
Description |
|---|---|