lemon/list_graph.h
changeset 2111 ea1fa1bc3f6d
parent 2107 e1055232c670
child 2114 677ea6c8169a
     1.1 --- a/lemon/list_graph.h	Mon Jun 26 15:40:35 2006 +0000
     1.2 +++ b/lemon/list_graph.h	Wed Jun 28 15:06:24 2006 +0000
     1.3 @@ -274,7 +274,7 @@
     1.4      }
     1.5  
     1.6    protected:
     1.7 -    void _changeTarget(Edge e, Node n) 
     1.8 +    void changeTarget(Edge e, Node n) 
     1.9      {
    1.10        if(edges[e.id].next_in != -1)
    1.11  	edges[edges[e.id].next_in].prev_in = edges[e.id].prev_in;
    1.12 @@ -289,7 +289,7 @@
    1.13        edges[e.id].next_in = nodes[n.id].first_in;
    1.14        nodes[n.id].first_in = e.id;
    1.15      }
    1.16 -    void _changeSource(Edge e, Node n) 
    1.17 +    void changeSource(Edge e, Node n) 
    1.18      {
    1.19        if(edges[e.id].next_out != -1)
    1.20  	edges[edges[e.id].next_out].prev_out = edges[e.id].prev_out;
    1.21 @@ -316,16 +316,32 @@
    1.22  
    1.23    ///This is a simple and fast erasable graph implementation.
    1.24    ///
    1.25 -  ///It conforms to the
    1.26 -  ///\ref concept::ErasableGraph "ErasableGraph" concept and
    1.27 -  ///it also provides several additional useful extra functionalities.
    1.28 -  ///\sa concept::ErasableGraph.
    1.29 +  ///It conforms to the \ref concept::Graph "Graph" concept and it
    1.30 +  ///also provides several additional useful extra functionalities.
    1.31 +  ///The most of the member functions and nested classes are
    1.32 +  ///documented only in the concept class.
    1.33 +  ///\sa concept::Graph.
    1.34  
    1.35    class ListGraph : public ExtendedListGraphBase {
    1.36    public:
    1.37  
    1.38      typedef ExtendedListGraphBase Parent;
    1.39  
    1.40 +    ///Add a new node to the graph.
    1.41 +    
    1.42 +    /// \return the new node.
    1.43 +    ///
    1.44 +    Node addNode() { return Parent::addNode(); }
    1.45 +
    1.46 +    ///Add a new edge to the graph.
    1.47 +    
    1.48 +    ///Add a new edge to the graph with source node \c s
    1.49 +    ///and target node \c t.
    1.50 +    ///\return the new edge.
    1.51 +    Edge addEdge(const Node& s, const Node& t) { 
    1.52 +      return Parent::addEdge(s, t); 
    1.53 +    }
    1.54 +
    1.55      /// Changes the target of \c e to \c n
    1.56  
    1.57      /// Changes the target of \c e to \c n
    1.58 @@ -334,7 +350,7 @@
    1.59      ///referencing the changed edge remain
    1.60      ///valid. However <tt>InEdge</tt>s are invalidated.
    1.61      void changeTarget(Edge e, Node n) { 
    1.62 -      _changeTarget(e,n); 
    1.63 +      Parent::changeTarget(e,n); 
    1.64      }
    1.65      /// Changes the source of \c e to \c n
    1.66  
    1.67 @@ -344,7 +360,7 @@
    1.68      ///referencing the changed edge remain
    1.69      ///valid. However <tt>OutEdge</tt>s are invalidated.
    1.70      void changeSource(Edge e, Node n) { 
    1.71 -      _changeSource(e,n);
    1.72 +      Parent::changeSource(e,n);
    1.73      }
    1.74  
    1.75      /// Invert the direction of an edge.
    1.76 @@ -354,12 +370,12 @@
    1.77      ///valid. However <tt>OutEdge</tt>s  and <tt>InEdge</tt>s are invalidated.
    1.78      void reverseEdge(Edge e) {
    1.79        Node t=target(e);
    1.80 -      _changeTarget(e,source(e));
    1.81 -      _changeSource(e,t);
    1.82 +      changeTarget(e,source(e));
    1.83 +      changeSource(e,t);
    1.84      }
    1.85  
    1.86 -    ///Using this it is possible to avoid the superfluous memory
    1.87 -    ///allocation.
    1.88 +    /// \brief Using this it is possible to avoid the superfluous memory
    1.89 +    /// allocation.
    1.90  
    1.91      ///Using this it is possible to avoid the superfluous memory
    1.92      ///allocation: if you know that the graph you want to build will
    1.93 @@ -367,8 +383,8 @@
    1.94      ///space for this amount before starting to build the graph.
    1.95      void reserveNode(int n) { nodes.reserve(n); };
    1.96  
    1.97 -    ///Using this it is possible to avoid the superfluous memory
    1.98 -    ///allocation.
    1.99 +    /// \brief Using this it is possible to avoid the superfluous memory
   1.100 +    /// allocation.
   1.101  
   1.102      ///Using this it is possible to avoid the superfluous memory
   1.103      ///allocation: see the \ref reserveNode function.
   1.104 @@ -598,6 +614,20 @@
   1.105    class ListUGraph : public ExtendedListUGraphBase {
   1.106    public:
   1.107      typedef ExtendedListUGraphBase Parent;
   1.108 +    /// \brief Add a new node to the graph.
   1.109 +    ///
   1.110 +    /// \return the new node.
   1.111 +    ///
   1.112 +    Node addNode() { return Parent::addNode(); }
   1.113 +
   1.114 +    /// \brief Add a new edge to the graph.
   1.115 +    ///
   1.116 +    /// Add a new edge to the graph with source node \c s
   1.117 +    /// and target node \c t.
   1.118 +    /// \return the new undirected edge.
   1.119 +    UEdge addEdge(const Node& s, const Node& t) { 
   1.120 +      return Parent::addEdge(s, t); 
   1.121 +    }
   1.122      /// \brief Changes the target of \c e to \c n
   1.123      ///
   1.124      /// Changes the target of \c e to \c n
   1.125 @@ -606,7 +636,7 @@
   1.126      /// referencing the changed edge remain
   1.127      /// valid. However <tt>InEdge</tt>'s are invalidated.
   1.128      void changeTarget(UEdge e, Node n) { 
   1.129 -      _changeTarget(e,n); 
   1.130 +      Parent::changeTarget(e,n); 
   1.131      }
   1.132      /// Changes the source of \c e to \c n
   1.133      ///
   1.134 @@ -616,7 +646,7 @@
   1.135      ///referencing the changed edge remain
   1.136      ///valid. However <tt>OutEdge</tt>'s are invalidated.
   1.137      void changeSource(UEdge e, Node n) { 
   1.138 -      _changeSource(e,n); 
   1.139 +      Parent::changeSource(e,n); 
   1.140      }
   1.141      /// \brief Contract two nodes.
   1.142      ///