COIN-OR::LEMON - Graph Library

Changeset 969:0631847b37e5 in lemon-0.x


Ignore:
Timestamp:
11/08/04 16:24:53 (16 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1356
Message:

findEdge() declaration went to the right place (for the sake of Doxygen.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/lemon/smart_graph.h

    r959 r969  
    4646  /// @{
    4747
     48  ///Base of SmartGraph
     49
     50  ///Base of SmartGraph
     51  ///
    4852  class SmartGraphBase {
    4953
     
    132136    }
    133137
    134     /// Finds an edge between two nodes.
    135 
    136     /// Finds an edge from node \c u to node \c v.
    137     ///
    138     /// If \c prev is \ref INVALID (this is the default value), then
    139     /// It finds the first edge from \c u to \c v. Otherwise it looks for
    140     /// the next edge from \c u to \c v after \c prev.
    141     /// \return The found edge or INVALID if there is no such an edge.
    142     Edge findEdge(Node u,Node v, Edge prev = INVALID)
    143     {
    144       int e = (prev.n==-1)? nodes[u.n].first_out : edges[prev.n].next_out;
    145       while(e!=-1 && edges[e].tail!=v.n) e = edges[e].next_out;
    146       prev.n=e;
    147       return prev;
    148     }
    149    
    150138    void clear() {
    151139      edges.clear();
     
    215203    }
    216204
     205    Edge _findEdge(Node u,Node v, Edge prev = INVALID)
     206    {
     207      int e = (prev.n==-1)? nodes[u.n].first_out : edges[prev.n].next_out;
     208      while(e!=-1 && edges[e].tail!=v.n) e = edges[e].next_out;
     209      prev.n=e;
     210      return prev;
     211    }
    217212  };
    218213
     
    243238  ///
    244239  ///\author Alpar Juttner
    245   class SmartGraph :public ClearableSmartGraphBase { };
     240  class SmartGraph :public ClearableSmartGraphBase {
     241  public:
     242    /// Finds an edge between two nodes.
     243
     244    /// Finds an edge from node \c u to node \c v.
     245    ///
     246    /// If \c prev is \ref INVALID (this is the default value), then
     247    /// it finds the first edge from \c u to \c v. Otherwise it looks for
     248    /// the next edge from \c u to \c v after \c prev.
     249    /// \return The found edge or \ref INVALID if there is no such an edge.
     250    ///
     251    /// Thus you can iterate through each edge from \c u to \c v as it follows.
     252    /// \code
     253    /// for(Edge e=G.findEdge(u,v);e!=INVALID;e=G.findEdge(u,v,e)) {
     254    ///   ...
     255    /// }
     256    /// \endcode
     257    /// \todo Possibly it should be a global function.
     258    Edge findEdge(Node u,Node v, Edge prev = INVALID)
     259    {
     260      return _findEdge(u,v,prev);
     261    }
     262};
    246263 
    247264  template <>
Note: See TracChangeset for help on using the changeset viewer.