COIN-OR::LEMON - Graph Library

Changes in / [413:d8b87e9b90c3:418:ad483acf1654] in lemon-main


Ignore:
Files:
5 added
3 edited

Legend:

Unmodified
Added
Removed
  • doc/groups.dox

    r406 r418  
    6060
    6161<b>See also:</b> \ref graph_concepts "Graph Structure Concepts".
     62*/
     63
     64/**
     65@defgroup graph_adaptors Adaptor Classes for graphs
     66@ingroup graphs
     67\brief This group contains several adaptor classes for digraphs and graphs
     68
     69The main parts of LEMON are the different graph structures, generic
     70graph algorithms, graph concepts which couple these, and graph
     71adaptors. While the previous notions are more or less clear, the
     72latter one needs further explanation. Graph adaptors are graph classes
     73which serve for considering graph structures in different ways.
     74
     75A short example makes this much clearer.  Suppose that we have an
     76instance \c g of a directed graph type say ListDigraph and an algorithm
     77\code
     78template <typename Digraph>
     79int algorithm(const Digraph&);
     80\endcode
     81is needed to run on the reverse oriented graph.  It may be expensive
     82(in time or in memory usage) to copy \c g with the reversed
     83arcs.  In this case, an adaptor class is used, which (according
     84to LEMON digraph concepts) works as a digraph.  The adaptor uses the
     85original digraph structure and digraph operations when methods of the
     86reversed oriented graph are called.  This means that the adaptor have
     87minor memory usage, and do not perform sophisticated algorithmic
     88actions.  The purpose of it is to give a tool for the cases when a
     89graph have to be used in a specific alteration.  If this alteration is
     90obtained by a usual construction like filtering the arc-set or
     91considering a new orientation, then an adaptor is worthwhile to use.
     92To come back to the reverse oriented graph, in this situation
     93\code
     94template<typename Digraph> class ReverseDigraph;
     95\endcode
     96template class can be used. The code looks as follows
     97\code
     98ListDigraph g;
     99ReverseDigraph<ListGraph> rg(g);
     100int result = algorithm(rg);
     101\endcode
     102After running the algorithm, the original graph \c g is untouched.
     103This techniques gives rise to an elegant code, and based on stable
     104graph adaptors, complex algorithms can be implemented easily.
     105
     106In flow, circulation and bipartite matching problems, the residual
     107graph is of particular importance. Combining an adaptor implementing
     108this, shortest path algorithms and minimum mean cycle algorithms,
     109a range of weighted and cardinality optimization algorithms can be
     110obtained. For other examples, the interested user is referred to the
     111detailed documentation of particular adaptors.
     112
     113The behavior of graph adaptors can be very different. Some of them keep
     114capabilities of the original graph while in other cases this would be
     115meaningless. This means that the concepts that they are models of depend
     116on the graph adaptor, and the wrapped graph(s).
     117If an arc of \c rg is deleted, this is carried out by deleting the
     118corresponding arc of \c g, thus the adaptor modifies the original graph.
     119
     120But for a residual graph, this operation has no sense.
     121Let us stand one more example here to simplify your work.
     122RevGraphAdaptor has constructor
     123\code
     124ReverseDigraph(Digraph& digraph);
     125\endcode
     126This means that in a situation, when a <tt>const ListDigraph&</tt>
     127reference to a graph is given, then it have to be instantiated with
     128<tt>Digraph=const ListDigraph</tt>.
     129\code
     130int algorithm1(const ListDigraph& g) {
     131  RevGraphAdaptor<const ListDigraph> rg(g);
     132  return algorithm2(rg);
     133}
     134\endcode
    62135*/
    63136
  • lemon/Makefile.am

    r409 r418  
    1717
    1818lemon_HEADERS += \
     19        lemon/adaptors.h \
    1920        lemon/arg_parser.h \
    2021        lemon/assert.h \
     
    6162        lemon/bits/default_map.h \
    6263        lemon/bits/enable_if.h \
     64        lemon/bits/graph_adaptor_extender.h \
    6365        lemon/bits/graph_extender.h \
    6466        lemon/bits/map_extender.h \
    6567        lemon/bits/path_dump.h \
    6668        lemon/bits/traits.h \
     69        lemon/bits/variant.h \
    6770        lemon/bits/vector_map.h
    6871
  • test/Makefile.am

    r410 r418  
    1717        test/dim_test \
    1818        test/error_test \
     19        test/graph_adaptor_test \
    1920        test/graph_copy_test \
    2021        test/graph_test \
     
    4546test_dim_test_SOURCES = test/dim_test.cc
    4647test_error_test_SOURCES = test/error_test.cc
     48test_graph_adaptor_test_SOURCES = test/graph_adaptor_test.cc
    4749test_graph_copy_test_SOURCES = test/graph_copy_test.cc
    4850test_graph_test_SOURCES = test/graph_test.cc
Note: See TracChangeset for help on using the changeset viewer.