doc/graphs.dox
changeset 2485 88aa7870756a
parent 2391 14a343be7a5a
child 2553 bfced05fa852
equal deleted inserted replaced
19:b118a0ca6f1f 20:d3316860fff7
    14  * express or implied, and with no claim as to its suitability for any
    14  * express or implied, and with no claim as to its suitability for any
    15  * purpose.
    15  * purpose.
    16  *
    16  *
    17  */
    17  */
    18 
    18 
       
    19 namespace lemon {
       
    20 
    19 /*!
    21 /*!
    20 
       
    21 \page graphs Graphs
    22 \page graphs Graphs
    22 
    23 
    23 \todo Write a new Graphs page. I think it should be contain the Graph,
    24 \todo Write a new Graphs page. I think it should be contain the Graph,
    24 UGraph and BpUGraph concept. It should be describe the iterators and
    25 UGraph and BpUGraph concept. It should be describe the iterators and
    25 the basic functions and the differences of the implementations.
    26 the basic functions and the differences of the implementations.
    27 The primary data structures of LEMON are the graph classes. They all
    28 The primary data structures of LEMON are the graph classes. They all
    28 provide a node list - edge list interface, i.e. they have
    29 provide a node list - edge list interface, i.e. they have
    29 functionalities to list the nodes and the edges of the graph as well
    30 functionalities to list the nodes and the edges of the graph as well
    30 as  incoming and outgoing edges of a given node. 
    31 as  incoming and outgoing edges of a given node. 
    31 
    32 
    32 Each graph should meet the \ref lemon::concepts::Graph "Graph" concept.
    33 Each graph should meet the \ref concepts::Graph "Graph" concept.
    33 This concept does not make it possible to change the graph (i.e. it is
    34 This concept does not make it possible to change the graph (i.e. it is
    34 not possible to add or delete edges or nodes). Most of the graph
    35 not possible to add or delete edges or nodes). Most of the graph
    35 algorithms will run on these graphs.
    36 algorithms will run on these graphs.
    36 
    37 
    37 
    38 
    38 In case of graphs meeting the full feature
    39 In case of graphs meeting the full feature
    39 \ref lemon::concepts::ErasableGraph "ErasableGraph"
    40 \ref concepts::ErasableGraph "ErasableGraph" concept
    40 concept
       
    41 you can also erase individual edges and nodes in arbitrary order.
    41 you can also erase individual edges and nodes in arbitrary order.
    42 
    42 
    43 The implemented graph structures are the following.
    43 The implemented graph structures are the following.
    44 \li \ref lemon::ListGraph "ListGraph" is the most versatile graph class. It meets
    44 \li \ref ListGraph is the most versatile graph class. It meets
    45 the \ref lemon::concepts::ErasableGraph "ErasableGraph" concept
    45 the \ref concepts::ErasableGraph "ErasableGraph" concept
    46 and it also has some convenient extra features.
    46 and it also has some convenient extra features.
    47 \li \ref lemon::SmartGraph "SmartGraph" is a more memory
    47 \li \ref SmartGraph is a more memory efficient version of \ref ListGraph.
    48 efficient version of \ref lemon::ListGraph "ListGraph". The
    48 The price of this is that it only meets the
    49 price of this is that it only meets the
    49 \ref concepts::ExtendableGraph "ExtendableGraph" concept,
    50 \ref lemon::concepts::ExtendableGraph "ExtendableGraph" concept,
       
    51 so you cannot delete individual edges or nodes.
    50 so you cannot delete individual edges or nodes.
    52 \li \ref lemon::FullGraph "FullGraph"
    51 \li \ref FullGraph "FullGraph"
    53 implements a complete graph. It is a
    52 implements a complete graph. It is a
    54 \ref lemon::concepts::Graph "Graph", so you cannot
    53 \ref concepts::Graph "Graph", so you cannot
    55 change the number of nodes once it is constructed. It is extremely memory
    54 change the number of nodes once it is constructed. It is extremely memory
    56 efficient: it uses constant amount of memory independently from the number of
    55 efficient: it uses constant amount of memory independently from the number of
    57 the nodes of the graph. Of course, the size of the \ref maps-page "NodeMap"'s and
    56 the nodes of the graph. Of course, the size of the \ref maps-page "NodeMap"'s and
    58 \ref maps-page "EdgeMap"'s will depend on the number of nodes.
    57 \ref maps-page "EdgeMap"'s will depend on the number of nodes.
    59 
    58 
    60 \li \ref lemon::NodeSet "NodeSet" implements a graph with no edges. This class
    59 \li \ref NodeSet "NodeSet" implements a graph with no edges. This class
    61 can be used as a base class of \ref lemon::EdgeSet "EdgeSet".
    60 can be used as a base class of \ref lemon::EdgeSet "EdgeSet".
    62 \li \ref lemon::EdgeSet "EdgeSet" can be used to create a new graph on
    61 \li \ref EdgeSet "EdgeSet" can be used to create a new graph on
    63 the node set of another graph. The base graph can be an arbitrary graph and it
    62 the node set of another graph. The base graph can be an arbitrary graph and it
    64 is possible to attach several \ref lemon::EdgeSet "EdgeSet"'s to a base graph.
    63 is possible to attach several \ref EdgeSet "EdgeSet"'s to a base graph.
    65 
    64 
    66 \todo Don't we need SmartNodeSet and SmartEdgeSet?
    65 \todo Don't we need SmartNodeSet and SmartEdgeSet?
    67 \todo Some cross-refs are wrong.
    66 \todo Some cross-refs are wrong.
    68 
    67 
    69 The graph structures themselves can not store data attached
    68 The graph structures themselves can not store data attached
   118 
   117 
   119 Here we iterate through all nodes of the graph. We use a constructor of the
   118 Here we iterate through all nodes of the graph. We use a constructor of the
   120 node iterator to initialize it to the first node. The operator++ is used to
   119 node iterator to initialize it to the first node. The operator++ is used to
   121 step to the next node. Using operator++ on the iterator pointing to the last
   120 step to the next node. Using operator++ on the iterator pointing to the last
   122 node invalidates the iterator i.e. sets its value to
   121 node invalidates the iterator i.e. sets its value to
   123 \ref lemon::INVALID "INVALID". This is what we exploit in the stop condition.
   122 \ref INVALID. This is what we exploit in the stop condition.
   124 
   123 
   125 The previous code fragment prints out the following:
   124 The previous code fragment prints out the following:
   126 
   125 
   127 \code
   126 \code
   128 Nodes: 2 1 0
   127 Nodes: 2 1 0
   198 
   197 
   199 Here we used the maps provided by the ListGraph class, but you can also write
   198 Here we used the maps provided by the ListGraph class, but you can also write
   200 your own maps. You can read more about using maps \ref maps-page "here".
   199 your own maps. You can read more about using maps \ref maps-page "here".
   201 
   200 
   202 */
   201 */
       
   202 
       
   203 }
       
   204