# HG changeset patch # User marci # Date 1111597153 0 # Node ID 4fee8e9d901470cad8939069d4d08249bdc9ac48 # Parent 8f7ce70899e656de7355e7de8274a257d1e9c410 documentation diff -r 8f7ce70899e6 -r 4fee8e9d9014 doc/gwrappers.dox --- a/doc/gwrappers.dox Wed Mar 23 15:43:18 2005 +0000 +++ b/doc/gwrappers.dox Wed Mar 23 16:59:13 2005 +0000 @@ -5,50 +5,69 @@ The main parts of LEMON are the different graph structures, generic graph algorithms, graph concepts which couple these, and - graph wrappers. While the previous ones are more or less clear, the - latter notion needs further explanation. + graph wrappers. While the previous notions are more or less clear, the + latter one needs further explanation. Graph wrappers are graph classes which serve for considering graph - structures in different ways. A short example makes the notion much + structures in different ways. + + A short example makes this much clearer. Suppose that we have an instance \c g of a directed graph - type say \c ListGraph and an algorithm + type say ListGraph and an algorithm \code template int algorithm(const Graph&); \endcode - is needed to run on the reversely oriented graph. + is needed to run on the reversed oriented graph. It may be expensive (in time or in memory usage) to copy - \c g with the reverse orientation. - Thus, a wrapper class - \code template class RevGraphWrapper; \endcode is used. - The code looks as follows + \c g with the reversed orientation. + In this case, a wrapper class is used, which + (according to LEMON graph concepts) works as a graph. + The wrapper uses + the original graph structure and graph operations when methods of the + reversed oriented graph are called. + This means that the wrapper 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 edge-set or considering a new orientation, then + a wrapper is worthwhile to use. + To come back to the reversed oriented graph, in this situation + \code template class RevGraphWrapper; \endcode + template class can be used. + The code looks as follows \code ListGraph g; RevGraphWrapper rgw(g); int result=algorithm(rgw); \endcode After running the algorithm, the original graph \c g - remains untouched. Thus the graph wrapper used above is to consider the - original graph with reverse orientation. + is untouched. 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. + obtained. + For other examples, + the interested user is referred to the detailed documentation of + particular 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 + meaningless. This means that the concepts that they are models of depend on the graph wrapper, and the wrapped graph(s). If an edge of \c rgw is deleted, this is carried out by - deleting the corresponding edge of \c g. But for a residual + deleting the corresponding edge of \c g, thus the wrapper modifies the + original graph. + But for a residual graph, this operation has no sense. - Let we stand one more example here to simplify your work. - wrapper class - \code template class RevGraphWrapper; \endcode - has constructor - RevGraphWrapper(Graph& _g). + Let us stand one more example here to simplify your work. + RevGraphWrapper has constructor + \code + RevGraphWrapper(Graph& _g); + \endcode 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. diff -r 8f7ce70899e6 -r 4fee8e9d9014 src/lemon/graph_wrapper.h --- a/src/lemon/graph_wrapper.h Wed Mar 23 15:43:18 2005 +0000 +++ b/src/lemon/graph_wrapper.h Wed Mar 23 16:59:13 2005 +0000 @@ -434,11 +434,11 @@ two nodes \c s and \c t. Shortest here means being shortest w.r.t. non-negative edge-lengths. Note that the comprehension of the presented solution - need's some knowledge from elementary combinatorial optimization. + need's some elementary knowledge from combinatorial optimization. If a single shortest path is to be - searched between two nodes \c s and \c t, then this can be done easily by - applying the Dijkstra algorithm class. What happens, if a maximum number of + searched between \c s and \c t, then this can be done easily by + applying the Dijkstra algorithm. What happens, if a maximum number of edge-disjoint shortest paths is to be computed. It can be proved that an edge can be in a shortest path if and only if it is tight with respect to the potential function computed by Dijkstra. Moreover, any path containing @@ -923,7 +923,8 @@ /// But BidirGraphWrapper is obtained from /// SubBidirGraphWrapper by considering everywhere true /// valued maps both for forward_filter and backward_filter. - /// Finally, one of the most important applications of SubBidirGraphWrapper + /// + /// The most important application of SubBidirGraphWrapper /// is ResGraphWrapper, which stands for the residual graph in directed /// flow and circulation problems. /// As wrappers usually, the SubBidirGraphWrapper implements the