COIN-OR::LEMON - Graph Library

Changeset 967:6563019430ba in lemon-0.x for src/lemon/graph_utils.h


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

Several changes in doc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/lemon/graph_utils.h

    r964 r967  
    9090    }
    9191    return num;
     92  }
     93
     94  /// Finds an edge between two nodes of a graph.
     95
     96  /// Finds an edge from node \c u to node \c v in graph \c g.
     97  ///
     98  /// If \c prev is \ref INVALID (this is the default value), then
     99  /// it finds the first edge from \c u to \c v. Otherwise it looks for
     100  /// the next edge from \c u to \c v after \c prev.
     101  /// \return The found edge or \ref INVALID if there is no such an edge.
     102  ///
     103  /// Thus you can iterate through each edge from \c u to \c v as it follows.
     104  /// \code
     105  /// for(Edge e=findEdge(g,u,v);e!=INVALID;e=findEdge(g,u,v,e)) {
     106  ///   ...
     107  /// }
     108  /// \endcode
     109  /// \todo We may want to use the \ref concept::GraphBase "GraphBase"
     110  /// interface here...
     111  /// \bug Untested ...
     112  template <typename Graph>
     113  typename Graph::Edge findEdge(const Graph &g,
     114                typename Graph::Node u, typename Graph::Node v,
     115                typename Graph::Edge prev = INVALID)
     116  {
     117    typename Graph::OutEdgeIt e(g,prev);
     118    if(prev==INVALID) g.first(e,u);
     119    else ++e;
     120    while(e!=INVALID && g.tail(e)!=v) ++e;
     121    return e;
    92122  }
    93123 
Note: See TracChangeset for help on using the changeset viewer.