lemon/concepts/bpgraph.h
changeset 1192 b79ff94e27d9
parent 1092 dceba191c00d
child 1210 da87dbdf3daf
equal deleted inserted replaced
7:5c1495e23c45 8:f7a05acec536
    25 
    25 
    26 #include <lemon/concepts/graph_components.h>
    26 #include <lemon/concepts/graph_components.h>
    27 #include <lemon/concepts/maps.h>
    27 #include <lemon/concepts/maps.h>
    28 #include <lemon/concept_check.h>
    28 #include <lemon/concept_check.h>
    29 #include <lemon/core.h>
    29 #include <lemon/core.h>
       
    30 #include <lemon/bits/stl_iterators.h>
    30 
    31 
    31 namespace lemon {
    32 namespace lemon {
    32   namespace concepts {
    33   namespace concepts {
    33 
    34 
    34     /// \ingroup graph_concepts
    35     /// \ingroup graph_concepts
   219         /// Assign the iterator to the next red node.
   220         /// Assign the iterator to the next red node.
   220         ///
   221         ///
   221         RedNodeIt& operator++() { return *this; }
   222         RedNodeIt& operator++() { return *this; }
   222       };
   223       };
   223 
   224 
       
   225       /// \brief Gets the collection of the red nodes of the graph.
       
   226       ///
       
   227       /// This function can be used for iterating on
       
   228       /// the red nodes of the graph. It returns a wrapped RedNodeIt,
       
   229       /// which looks like an STL container (by having begin() and end())
       
   230       /// which you can use in range-based for loops, stl algorithms, etc.
       
   231       /// For example if g is a BpGraph, you can write:
       
   232       ///\code
       
   233       /// for(auto v: g.redNodes())
       
   234       ///   doSomething(v);
       
   235       ///\endcode
       
   236       LemonRangeWrapper1<RedNodeIt, BpGraph> redNodes() const {
       
   237         return LemonRangeWrapper1<RedNodeIt, BpGraph>(*this);
       
   238       }
       
   239 
       
   240 
   224       /// Iterator class for the blue nodes.
   241       /// Iterator class for the blue nodes.
   225 
   242 
   226       /// This iterator goes through each blue node of the graph.
   243       /// This iterator goes through each blue node of the graph.
   227       /// Its usage is quite simple, for example, you can count the number
   244       /// Its usage is quite simple, for example, you can count the number
   228       /// of blue nodes in a graph \c g of type \c %BpGraph like this:
   245       /// of blue nodes in a graph \c g of type \c %BpGraph like this:
   262         /// Assign the iterator to the next blue node.
   279         /// Assign the iterator to the next blue node.
   263         ///
   280         ///
   264         BlueNodeIt& operator++() { return *this; }
   281         BlueNodeIt& operator++() { return *this; }
   265       };
   282       };
   266 
   283 
       
   284       /// \brief Gets the collection of the blue nodes of the graph.
       
   285       ///
       
   286       /// This function can be used for iterating on
       
   287       /// the blue nodes of the graph. It returns a wrapped BlueNodeIt,
       
   288       /// which looks like an STL container (by having begin() and end())
       
   289       /// which you can use in range-based for loops, stl algorithms, etc.
       
   290       /// For example if g is a BpGraph, you can write:
       
   291       ///\code
       
   292       /// for(auto v: g.blueNodes())
       
   293       ///   doSomething(v);
       
   294       ///\endcode
       
   295       LemonRangeWrapper1<BlueNodeIt, BpGraph> blueNodes() const {
       
   296         return LemonRangeWrapper1<BlueNodeIt, BpGraph>(*this);
       
   297       }
       
   298 
       
   299 
   267       /// Iterator class for the nodes.
   300       /// Iterator class for the nodes.
   268 
   301 
   269       /// This iterator goes through each node of the graph.
   302       /// This iterator goes through each node of the graph.
   270       /// Its usage is quite simple, for example, you can count the number
   303       /// Its usage is quite simple, for example, you can count the number
   271       /// of nodes in a graph \c g of type \c %BpGraph like this:
   304       /// of nodes in a graph \c g of type \c %BpGraph like this:
   304 
   337 
   305         /// Assign the iterator to the next node.
   338         /// Assign the iterator to the next node.
   306         ///
   339         ///
   307         NodeIt& operator++() { return *this; }
   340         NodeIt& operator++() { return *this; }
   308       };
   341       };
       
   342 
       
   343       /// \brief Gets the collection of the nodes of the graph.
       
   344       ///
       
   345       /// This function can be used for iterating on
       
   346       /// the nodes of the graph. It returns a wrapped NodeIt,
       
   347       /// which looks like an STL container (by having begin() and end())
       
   348       /// which you can use in range-based for loops, stl algorithms, etc.
       
   349       /// For example if g is a BpGraph, you can write:
       
   350       ///\code
       
   351       /// for(auto v: g.nodes())
       
   352       ///   doSomething(v);
       
   353       ///\endcode
       
   354       LemonRangeWrapper1<NodeIt, BpGraph> nodes() const {
       
   355         return LemonRangeWrapper1<NodeIt, BpGraph>(*this);
       
   356       }
       
   357 
   309 
   358 
   310 
   359 
   311       /// The edge type of the graph
   360       /// The edge type of the graph
   312 
   361 
   313       /// This class identifies an edge of the graph. It also serves
   362       /// This class identifies an edge of the graph. It also serves
   392 
   441 
   393         /// Assign the iterator to the next edge.
   442         /// Assign the iterator to the next edge.
   394         ///
   443         ///
   395         EdgeIt& operator++() { return *this; }
   444         EdgeIt& operator++() { return *this; }
   396       };
   445       };
       
   446 
       
   447       /// \brief Gets the collection of the edges of the graph.
       
   448       ///
       
   449       /// This function can be used for iterating on the
       
   450       /// edges of the graph. It returns a wrapped
       
   451       /// EdgeIt, which looks like an STL container
       
   452       /// (by having begin() and end()) which you can use in range-based
       
   453       /// for loops, stl algorithms, etc.
       
   454       /// For example if g is a BpGraph, you can write:
       
   455       ///\code
       
   456       /// for(auto e: g.edges())
       
   457       ///   doSomething(e);
       
   458       ///\endcode
       
   459       LemonRangeWrapper1<EdgeIt, BpGraph> edges() const {
       
   460         return LemonRangeWrapper1<EdgeIt, BpGraph>(*this);
       
   461       }
       
   462 
   397 
   463 
   398       /// Iterator class for the incident edges of a node.
   464       /// Iterator class for the incident edges of a node.
   399 
   465 
   400       /// This iterator goes trough the incident undirected edges
   466       /// This iterator goes trough the incident undirected edges
   401       /// of a certain node of a graph.
   467       /// of a certain node of a graph.
   441         /// Assign the iterator to the next incident edge
   507         /// Assign the iterator to the next incident edge
   442         /// of the corresponding node.
   508         /// of the corresponding node.
   443         IncEdgeIt& operator++() { return *this; }
   509         IncEdgeIt& operator++() { return *this; }
   444       };
   510       };
   445 
   511 
       
   512       /// \brief Gets the collection of the incident edges
       
   513       ///  of a certain node of the graph.
       
   514       ///
       
   515       /// This function can be used for iterating on the
       
   516       /// incident undirected edges of a certain node of the graph.
       
   517       /// It returns a wrapped
       
   518       /// IncEdgeIt, which looks like an STL container
       
   519       /// (by having begin() and end()) which you can use in range-based
       
   520       /// for loops, stl algorithms, etc.
       
   521       /// For example if g is a BpGraph and u is a Node, you can write:
       
   522       ///\code
       
   523       /// for(auto e: g.incEdges(u))
       
   524       ///   doSomething(e);
       
   525       ///\endcode
       
   526       LemonRangeWrapper2<IncEdgeIt, BpGraph, Node> incEdges(const Node& u) const {
       
   527         return LemonRangeWrapper2<IncEdgeIt, BpGraph, Node>(*this, u);
       
   528       }
       
   529 
       
   530 
   446       /// The arc type of the graph
   531       /// The arc type of the graph
   447 
   532 
   448       /// This class identifies a directed arc of the graph. It also serves
   533       /// This class identifies a directed arc of the graph. It also serves
   449       /// as a base class of the arc iterators,
   534       /// as a base class of the arc iterators,
   450       /// thus they will convert to this type.
   535       /// thus they will convert to this type.
   537         /// Assign the iterator to the next arc.
   622         /// Assign the iterator to the next arc.
   538         ///
   623         ///
   539         ArcIt& operator++() { return *this; }
   624         ArcIt& operator++() { return *this; }
   540       };
   625       };
   541 
   626 
       
   627       /// \brief Gets the collection of the directed arcs of the graph.
       
   628       ///
       
   629       /// This function can be used for iterating on the
       
   630       /// arcs of the graph. It returns a wrapped
       
   631       /// ArcIt, which looks like an STL container
       
   632       /// (by having begin() and end()) which you can use in range-based
       
   633       /// for loops, stl algorithms, etc.
       
   634       /// For example if g is a BpGraph you can write:
       
   635       ///\code
       
   636       /// for(auto a: g.arcs())
       
   637       ///   doSomething(a);
       
   638       ///\endcode
       
   639       LemonRangeWrapper1<ArcIt, BpGraph> arcs() const {
       
   640         return LemonRangeWrapper1<ArcIt, BpGraph>(*this);
       
   641       }
       
   642 
       
   643 
   542       /// Iterator class for the outgoing arcs of a node.
   644       /// Iterator class for the outgoing arcs of a node.
   543 
   645 
   544       /// This iterator goes trough the \e outgoing directed arcs of a
   646       /// This iterator goes trough the \e outgoing directed arcs of a
   545       /// certain node of a graph.
   647       /// certain node of a graph.
   546       /// Its usage is quite simple, for example, you can count the number
   648       /// Its usage is quite simple, for example, you can count the number
   585         /// Assign the iterator to the next
   687         /// Assign the iterator to the next
   586         /// outgoing arc of the corresponding node.
   688         /// outgoing arc of the corresponding node.
   587         OutArcIt& operator++() { return *this; }
   689         OutArcIt& operator++() { return *this; }
   588       };
   690       };
   589 
   691 
       
   692       /// \brief Gets the collection of the outgoing directed arcs of a
       
   693       /// certain node of the graph.
       
   694       ///
       
   695       /// This function can be used for iterating on the
       
   696       /// outgoing arcs of a certain node of the graph. It returns a wrapped
       
   697       /// OutArcIt, which looks like an STL container
       
   698       /// (by having begin() and end()) which you can use in range-based
       
   699       /// for loops, stl algorithms, etc.
       
   700       /// For example if g is a BpGraph and u is a Node, you can write:
       
   701       ///\code
       
   702       /// for(auto a: g.outArcs(u))
       
   703       ///   doSomething(a);
       
   704       ///\endcode
       
   705       LemonRangeWrapper2<OutArcIt, BpGraph, Node> outArcs(const Node& u) const {
       
   706         return LemonRangeWrapper2<OutArcIt, BpGraph, Node>(*this, u);
       
   707       }
       
   708 
       
   709 
   590       /// Iterator class for the incoming arcs of a node.
   710       /// Iterator class for the incoming arcs of a node.
   591 
   711 
   592       /// This iterator goes trough the \e incoming directed arcs of a
   712       /// This iterator goes trough the \e incoming directed arcs of a
   593       /// certain node of a graph.
   713       /// certain node of a graph.
   594       /// Its usage is quite simple, for example, you can count the number
   714       /// Its usage is quite simple, for example, you can count the number
   632 
   752 
   633         /// Assign the iterator to the next
   753         /// Assign the iterator to the next
   634         /// incoming arc of the corresponding node.
   754         /// incoming arc of the corresponding node.
   635         InArcIt& operator++() { return *this; }
   755         InArcIt& operator++() { return *this; }
   636       };
   756       };
       
   757 
       
   758       /// \brief Gets the collection of the incoming directed arcs of a
       
   759       /// certain node of the graph.
       
   760       ///
       
   761       /// This function can be used for iterating on the
       
   762       /// incoming arcs of a certain node of the graph. It returns a wrapped
       
   763       /// InArcIt, which looks like an STL container
       
   764       /// (by having begin() and end()) which you can use in range-based
       
   765       /// for loops, stl algorithms, etc.
       
   766       /// For example if g is a BpGraph and u is a Node, you can write:
       
   767       ///\code
       
   768       /// for(auto a: g.inArcs(u))
       
   769       ///   doSomething(a);
       
   770       ///\endcode
       
   771       LemonRangeWrapper2<InArcIt, BpGraph, Node> inArcs(const Node& u) const {
       
   772         return LemonRangeWrapper2<InArcIt, BpGraph, Node>(*this, u);
       
   773       }
       
   774 
   637 
   775 
   638       /// \brief Standard graph map type for the nodes.
   776       /// \brief Standard graph map type for the nodes.
   639       ///
   777       ///
   640       /// Standard graph map type for the nodes.
   778       /// Standard graph map type for the nodes.
   641       /// It conforms to the ReferenceMap concept.
   779       /// It conforms to the ReferenceMap concept.