lemon/concepts/bpgraph.h
changeset 1336 0759d974de81
parent 1270 dceba191c00d
child 1432 da87dbdf3daf
     1.1 --- a/lemon/concepts/bpgraph.h	Thu Apr 02 22:34:03 2015 +0200
     1.2 +++ b/lemon/concepts/bpgraph.h	Sun Jan 05 22:24:56 2014 +0100
     1.3 @@ -27,6 +27,7 @@
     1.4  #include <lemon/concepts/maps.h>
     1.5  #include <lemon/concept_check.h>
     1.6  #include <lemon/core.h>
     1.7 +#include <lemon/bits/stl_iterators.h>
     1.8  
     1.9  namespace lemon {
    1.10    namespace concepts {
    1.11 @@ -221,6 +222,22 @@
    1.12          RedNodeIt& operator++() { return *this; }
    1.13        };
    1.14  
    1.15 +      /// \brief Gets the collection of the red nodes of the graph.
    1.16 +      ///
    1.17 +      /// This function can be used for iterating on
    1.18 +      /// the red nodes of the graph. It returns a wrapped RedNodeIt,
    1.19 +      /// which looks like an STL container (by having begin() and end())
    1.20 +      /// which you can use in range-based for loops, stl algorithms, etc.
    1.21 +      /// For example if g is a BpGraph, you can write:
    1.22 +      ///\code
    1.23 +      /// for(auto v: g.redNodes())
    1.24 +      ///   doSomething(v);
    1.25 +      ///\endcode
    1.26 +      LemonRangeWrapper1<RedNodeIt, BpGraph> redNodes() const {
    1.27 +        return LemonRangeWrapper1<RedNodeIt, BpGraph>(*this);
    1.28 +      }
    1.29 +
    1.30 +
    1.31        /// Iterator class for the blue nodes.
    1.32  
    1.33        /// This iterator goes through each blue node of the graph.
    1.34 @@ -264,6 +281,22 @@
    1.35          BlueNodeIt& operator++() { return *this; }
    1.36        };
    1.37  
    1.38 +      /// \brief Gets the collection of the blue nodes of the graph.
    1.39 +      ///
    1.40 +      /// This function can be used for iterating on
    1.41 +      /// the blue nodes of the graph. It returns a wrapped BlueNodeIt,
    1.42 +      /// which looks like an STL container (by having begin() and end())
    1.43 +      /// which you can use in range-based for loops, stl algorithms, etc.
    1.44 +      /// For example if g is a BpGraph, you can write:
    1.45 +      ///\code
    1.46 +      /// for(auto v: g.blueNodes())
    1.47 +      ///   doSomething(v);
    1.48 +      ///\endcode
    1.49 +      LemonRangeWrapper1<BlueNodeIt, BpGraph> blueNodes() const {
    1.50 +        return LemonRangeWrapper1<BlueNodeIt, BpGraph>(*this);
    1.51 +      }
    1.52 +
    1.53 +
    1.54        /// Iterator class for the nodes.
    1.55  
    1.56        /// This iterator goes through each node of the graph.
    1.57 @@ -307,6 +340,22 @@
    1.58          NodeIt& operator++() { return *this; }
    1.59        };
    1.60  
    1.61 +      /// \brief Gets the collection of the nodes of the graph.
    1.62 +      ///
    1.63 +      /// This function can be used for iterating on
    1.64 +      /// the nodes of the graph. It returns a wrapped NodeIt,
    1.65 +      /// which looks like an STL container (by having begin() and end())
    1.66 +      /// which you can use in range-based for loops, stl algorithms, etc.
    1.67 +      /// For example if g is a BpGraph, you can write:
    1.68 +      ///\code
    1.69 +      /// for(auto v: g.nodes())
    1.70 +      ///   doSomething(v);
    1.71 +      ///\endcode
    1.72 +      LemonRangeWrapper1<NodeIt, BpGraph> nodes() const {
    1.73 +        return LemonRangeWrapper1<NodeIt, BpGraph>(*this);
    1.74 +      }
    1.75 +
    1.76 +
    1.77  
    1.78        /// The edge type of the graph
    1.79  
    1.80 @@ -395,6 +444,23 @@
    1.81          EdgeIt& operator++() { return *this; }
    1.82        };
    1.83  
    1.84 +      /// \brief Gets the collection of the edges of the graph.
    1.85 +      ///
    1.86 +      /// This function can be used for iterating on the
    1.87 +      /// edges of the graph. It returns a wrapped
    1.88 +      /// EdgeIt, which looks like an STL container
    1.89 +      /// (by having begin() and end()) which you can use in range-based
    1.90 +      /// for loops, stl algorithms, etc.
    1.91 +      /// For example if g is a BpGraph, you can write:
    1.92 +      ///\code
    1.93 +      /// for(auto e: g.edges())
    1.94 +      ///   doSomething(e);
    1.95 +      ///\endcode
    1.96 +      LemonRangeWrapper1<EdgeIt, BpGraph> edges() const {
    1.97 +        return LemonRangeWrapper1<EdgeIt, BpGraph>(*this);
    1.98 +      }
    1.99 +
   1.100 +
   1.101        /// Iterator class for the incident edges of a node.
   1.102  
   1.103        /// This iterator goes trough the incident undirected edges
   1.104 @@ -443,6 +509,25 @@
   1.105          IncEdgeIt& operator++() { return *this; }
   1.106        };
   1.107  
   1.108 +      /// \brief Gets the collection of the incident edges
   1.109 +      ///  of a certain node of the graph.
   1.110 +      ///
   1.111 +      /// This function can be used for iterating on the
   1.112 +      /// incident undirected edges of a certain node of the graph.
   1.113 +      /// It returns a wrapped
   1.114 +      /// IncEdgeIt, which looks like an STL container
   1.115 +      /// (by having begin() and end()) which you can use in range-based
   1.116 +      /// for loops, stl algorithms, etc.
   1.117 +      /// For example if g is a BpGraph and u is a Node, you can write:
   1.118 +      ///\code
   1.119 +      /// for(auto e: g.incEdges(u))
   1.120 +      ///   doSomething(e);
   1.121 +      ///\endcode
   1.122 +      LemonRangeWrapper2<IncEdgeIt, BpGraph, Node> incEdges(const Node& u) const {
   1.123 +        return LemonRangeWrapper2<IncEdgeIt, BpGraph, Node>(*this, u);
   1.124 +      }
   1.125 +
   1.126 +
   1.127        /// The arc type of the graph
   1.128  
   1.129        /// This class identifies a directed arc of the graph. It also serves
   1.130 @@ -539,6 +624,23 @@
   1.131          ArcIt& operator++() { return *this; }
   1.132        };
   1.133  
   1.134 +      /// \brief Gets the collection of the directed arcs of the graph.
   1.135 +      ///
   1.136 +      /// This function can be used for iterating on the
   1.137 +      /// arcs of the graph. It returns a wrapped
   1.138 +      /// ArcIt, which looks like an STL container
   1.139 +      /// (by having begin() and end()) which you can use in range-based
   1.140 +      /// for loops, stl algorithms, etc.
   1.141 +      /// For example if g is a BpGraph you can write:
   1.142 +      ///\code
   1.143 +      /// for(auto a: g.arcs())
   1.144 +      ///   doSomething(a);
   1.145 +      ///\endcode
   1.146 +      LemonRangeWrapper1<ArcIt, BpGraph> arcs() const {
   1.147 +        return LemonRangeWrapper1<ArcIt, BpGraph>(*this);
   1.148 +      }
   1.149 +
   1.150 +
   1.151        /// Iterator class for the outgoing arcs of a node.
   1.152  
   1.153        /// This iterator goes trough the \e outgoing directed arcs of a
   1.154 @@ -587,6 +689,24 @@
   1.155          OutArcIt& operator++() { return *this; }
   1.156        };
   1.157  
   1.158 +      /// \brief Gets the collection of the outgoing directed arcs of a
   1.159 +      /// certain node of the graph.
   1.160 +      ///
   1.161 +      /// This function can be used for iterating on the
   1.162 +      /// outgoing arcs of a certain node of the graph. It returns a wrapped
   1.163 +      /// OutArcIt, which looks like an STL container
   1.164 +      /// (by having begin() and end()) which you can use in range-based
   1.165 +      /// for loops, stl algorithms, etc.
   1.166 +      /// For example if g is a BpGraph and u is a Node, you can write:
   1.167 +      ///\code
   1.168 +      /// for(auto a: g.outArcs(u))
   1.169 +      ///   doSomething(a);
   1.170 +      ///\endcode
   1.171 +      LemonRangeWrapper2<OutArcIt, BpGraph, Node> outArcs(const Node& u) const {
   1.172 +        return LemonRangeWrapper2<OutArcIt, BpGraph, Node>(*this, u);
   1.173 +      }
   1.174 +
   1.175 +
   1.176        /// Iterator class for the incoming arcs of a node.
   1.177  
   1.178        /// This iterator goes trough the \e incoming directed arcs of a
   1.179 @@ -635,6 +755,24 @@
   1.180          InArcIt& operator++() { return *this; }
   1.181        };
   1.182  
   1.183 +      /// \brief Gets the collection of the incoming directed arcs of a
   1.184 +      /// certain node of the graph.
   1.185 +      ///
   1.186 +      /// This function can be used for iterating on the
   1.187 +      /// incoming arcs of a certain node of the graph. It returns a wrapped
   1.188 +      /// InArcIt, which looks like an STL container
   1.189 +      /// (by having begin() and end()) which you can use in range-based
   1.190 +      /// for loops, stl algorithms, etc.
   1.191 +      /// For example if g is a BpGraph and u is a Node, you can write:
   1.192 +      ///\code
   1.193 +      /// for(auto a: g.inArcs(u))
   1.194 +      ///   doSomething(a);
   1.195 +      ///\endcode
   1.196 +      LemonRangeWrapper2<InArcIt, BpGraph, Node> inArcs(const Node& u) const {
   1.197 +        return LemonRangeWrapper2<InArcIt, BpGraph, Node>(*this, u);
   1.198 +      }
   1.199 +
   1.200 +
   1.201        /// \brief Standard graph map type for the nodes.
   1.202        ///
   1.203        /// Standard graph map type for the nodes.