diff -r 39b6e65574c6 -r 0759d974de81 lemon/concepts/bpgraph.h --- a/lemon/concepts/bpgraph.h Thu Apr 02 22:34:03 2015 +0200 +++ b/lemon/concepts/bpgraph.h Sun Jan 05 22:24:56 2014 +0100 @@ -27,6 +27,7 @@ #include #include #include +#include namespace lemon { namespace concepts { @@ -221,6 +222,22 @@ RedNodeIt& operator++() { return *this; } }; + /// \brief Gets the collection of the red nodes of the graph. + /// + /// This function can be used for iterating on + /// the red nodes of the graph. It returns a wrapped RedNodeIt, + /// which looks like an STL container (by having begin() and end()) + /// which you can use in range-based for loops, stl algorithms, etc. + /// For example if g is a BpGraph, you can write: + ///\code + /// for(auto v: g.redNodes()) + /// doSomething(v); + ///\endcode + LemonRangeWrapper1 redNodes() const { + return LemonRangeWrapper1(*this); + } + + /// Iterator class for the blue nodes. /// This iterator goes through each blue node of the graph. @@ -264,6 +281,22 @@ BlueNodeIt& operator++() { return *this; } }; + /// \brief Gets the collection of the blue nodes of the graph. + /// + /// This function can be used for iterating on + /// the blue nodes of the graph. It returns a wrapped BlueNodeIt, + /// which looks like an STL container (by having begin() and end()) + /// which you can use in range-based for loops, stl algorithms, etc. + /// For example if g is a BpGraph, you can write: + ///\code + /// for(auto v: g.blueNodes()) + /// doSomething(v); + ///\endcode + LemonRangeWrapper1 blueNodes() const { + return LemonRangeWrapper1(*this); + } + + /// Iterator class for the nodes. /// This iterator goes through each node of the graph. @@ -307,6 +340,22 @@ NodeIt& operator++() { return *this; } }; + /// \brief Gets the collection of the nodes of the graph. + /// + /// This function can be used for iterating on + /// the nodes of the graph. It returns a wrapped NodeIt, + /// which looks like an STL container (by having begin() and end()) + /// which you can use in range-based for loops, stl algorithms, etc. + /// For example if g is a BpGraph, you can write: + ///\code + /// for(auto v: g.nodes()) + /// doSomething(v); + ///\endcode + LemonRangeWrapper1 nodes() const { + return LemonRangeWrapper1(*this); + } + + /// The edge type of the graph @@ -395,6 +444,23 @@ EdgeIt& operator++() { return *this; } }; + /// \brief Gets the collection of the edges of the graph. + /// + /// This function can be used for iterating on the + /// edges of the graph. It returns a wrapped + /// EdgeIt, which looks like an STL container + /// (by having begin() and end()) which you can use in range-based + /// for loops, stl algorithms, etc. + /// For example if g is a BpGraph, you can write: + ///\code + /// for(auto e: g.edges()) + /// doSomething(e); + ///\endcode + LemonRangeWrapper1 edges() const { + return LemonRangeWrapper1(*this); + } + + /// Iterator class for the incident edges of a node. /// This iterator goes trough the incident undirected edges @@ -443,6 +509,25 @@ IncEdgeIt& operator++() { return *this; } }; + /// \brief Gets the collection of the incident edges + /// of a certain node of the graph. + /// + /// This function can be used for iterating on the + /// incident undirected edges of a certain node of the graph. + /// It returns a wrapped + /// IncEdgeIt, which looks like an STL container + /// (by having begin() and end()) which you can use in range-based + /// for loops, stl algorithms, etc. + /// For example if g is a BpGraph and u is a Node, you can write: + ///\code + /// for(auto e: g.incEdges(u)) + /// doSomething(e); + ///\endcode + LemonRangeWrapper2 incEdges(const Node& u) const { + return LemonRangeWrapper2(*this, u); + } + + /// The arc type of the graph /// This class identifies a directed arc of the graph. It also serves @@ -539,6 +624,23 @@ ArcIt& operator++() { return *this; } }; + /// \brief Gets the collection of the directed arcs of the graph. + /// + /// This function can be used for iterating on the + /// arcs of the graph. It returns a wrapped + /// ArcIt, which looks like an STL container + /// (by having begin() and end()) which you can use in range-based + /// for loops, stl algorithms, etc. + /// For example if g is a BpGraph you can write: + ///\code + /// for(auto a: g.arcs()) + /// doSomething(a); + ///\endcode + LemonRangeWrapper1 arcs() const { + return LemonRangeWrapper1(*this); + } + + /// Iterator class for the outgoing arcs of a node. /// This iterator goes trough the \e outgoing directed arcs of a @@ -587,6 +689,24 @@ OutArcIt& operator++() { return *this; } }; + /// \brief Gets the collection of the outgoing directed arcs of a + /// certain node of the graph. + /// + /// This function can be used for iterating on the + /// outgoing arcs of a certain node of the graph. It returns a wrapped + /// OutArcIt, which looks like an STL container + /// (by having begin() and end()) which you can use in range-based + /// for loops, stl algorithms, etc. + /// For example if g is a BpGraph and u is a Node, you can write: + ///\code + /// for(auto a: g.outArcs(u)) + /// doSomething(a); + ///\endcode + LemonRangeWrapper2 outArcs(const Node& u) const { + return LemonRangeWrapper2(*this, u); + } + + /// Iterator class for the incoming arcs of a node. /// This iterator goes trough the \e incoming directed arcs of a @@ -635,6 +755,24 @@ InArcIt& operator++() { return *this; } }; + /// \brief Gets the collection of the incoming directed arcs of a + /// certain node of the graph. + /// + /// This function can be used for iterating on the + /// incoming arcs of a certain node of the graph. It returns a wrapped + /// InArcIt, which looks like an STL container + /// (by having begin() and end()) which you can use in range-based + /// for loops, stl algorithms, etc. + /// For example if g is a BpGraph and u is a Node, you can write: + ///\code + /// for(auto a: g.inArcs(u)) + /// doSomething(a); + ///\endcode + LemonRangeWrapper2 inArcs(const Node& u) const { + return LemonRangeWrapper2(*this, u); + } + + /// \brief Standard graph map type for the nodes. /// /// Standard graph map type for the nodes.