lemon/concepts/graph.h
changeset 95 cc7e6b8b59bf
parent 61 d718974f1290
child 107 31a2e6d28f61
equal deleted inserted replaced
1:29a4c031fd00 2:dea02f0ddae8
    61     /// of the directed arc and we can direct an edge.
    61     /// of the directed arc and we can direct an edge.
    62     ///
    62     ///
    63     /// The EdgeIt is an iterator for the edges. We can use
    63     /// The EdgeIt is an iterator for the edges. We can use
    64     /// the EdgeMap to map values for the edges. The InArcIt and
    64     /// the EdgeMap to map values for the edges. The InArcIt and
    65     /// OutArcIt iterates on the same edges but with opposite
    65     /// OutArcIt iterates on the same edges but with opposite
    66     /// direction. The IncArcIt iterates also on the same edges
    66     /// direction. The IncEdgeIt iterates also on the same edges
    67     /// as the OutArcIt and InArcIt but it is not convertible to Arc just
    67     /// as the OutArcIt and InArcIt but it is not convertible to Arc just
    68     /// to Edge.  
    68     /// to Edge.  
    69     class Graph {
    69     class Graph {
    70     public:
    70     public:
    71       /// \brief The undirected graph should be tagged by the
    71       /// \brief The undirected graph should be tagged by the
   268       /// degree (i.e. count the number of incident arcs of a node \c n
   268       /// degree (i.e. count the number of incident arcs of a node \c n
   269       /// in graph \c g of type \c Graph as follows. 
   269       /// in graph \c g of type \c Graph as follows. 
   270       ///
   270       ///
   271       ///\code
   271       ///\code
   272       /// int count=0;
   272       /// int count=0;
   273       /// for(Graph::IncArcIt e(g, n); e!=INVALID; ++e) ++count;
   273       /// for(Graph::IncEdgeIt e(g, n); e!=INVALID; ++e) ++count;
   274       ///\endcode
   274       ///\endcode
   275       class IncArcIt : public Edge {
   275       class IncEdgeIt : public Edge {
   276       public:
   276       public:
   277         /// Default constructor
   277         /// Default constructor
   278 
   278 
   279         /// @warning The default constructor sets the iterator
   279         /// @warning The default constructor sets the iterator
   280         /// to an undefined value.
   280         /// to an undefined value.
   281         IncArcIt() { }
   281         IncEdgeIt() { }
   282         /// Copy constructor.
   282         /// Copy constructor.
   283 
   283 
   284         /// Copy constructor.
   284         /// Copy constructor.
   285         ///
   285         ///
   286         IncArcIt(const IncArcIt& e) : Edge(e) { }
   286         IncEdgeIt(const IncEdgeIt& e) : Edge(e) { }
   287         /// Initialize the iterator to be invalid.
   287         /// Initialize the iterator to be invalid.
   288 
   288 
   289         /// Initialize the iterator to be invalid.
   289         /// Initialize the iterator to be invalid.
   290         ///
   290         ///
   291         IncArcIt(Invalid) { }
   291         IncEdgeIt(Invalid) { }
   292         /// This constructor sets the iterator to first incident arc.
   292         /// This constructor sets the iterator to first incident arc.
   293     
   293     
   294         /// This constructor set the iterator to the first incident arc of
   294         /// This constructor set the iterator to the first incident arc of
   295         /// the node.
   295         /// the node.
   296         IncArcIt(const Graph&, const Node&) { }
   296         IncEdgeIt(const Graph&, const Node&) { }
   297         /// Edge -> IncArcIt conversion
   297         /// Edge -> IncEdgeIt conversion
   298 
   298 
   299         /// Sets the iterator to the value of the trivial iterator \c e.
   299         /// Sets the iterator to the value of the trivial iterator \c e.
   300         /// This feature necessitates that each time we 
   300         /// This feature necessitates that each time we 
   301         /// iterate the arc-set, the iteration order is the same.
   301         /// iterate the arc-set, the iteration order is the same.
   302         IncArcIt(const Graph&, const Edge&) { }
   302         IncEdgeIt(const Graph&, const Edge&) { }
   303         /// Next incident arc
   303         /// Next incident arc
   304 
   304 
   305         /// Assign the iterator to the next incident arc
   305         /// Assign the iterator to the next incident arc
   306 	/// of the corresponding node.
   306 	/// of the corresponding node.
   307         IncArcIt& operator++() { return *this; }
   307         IncEdgeIt& operator++() { return *this; }
   308       };
   308       };
   309 
   309 
   310       /// The directed arc type.
   310       /// The directed arc type.
   311 
   311 
   312       /// The directed arc type. It can be converted to the
   312       /// The directed arc type. It can be converted to the
   718       }
   718       }
   719 
   719 
   720       /// \brief Base node of the iterator
   720       /// \brief Base node of the iterator
   721       ///
   721       ///
   722       /// Returns the base node of the iterator
   722       /// Returns the base node of the iterator
   723       Node baseNode(IncArcIt) const {
   723       Node baseNode(IncEdgeIt) const {
   724 	return INVALID;
   724 	return INVALID;
   725       }
   725       }
   726       
   726       
   727       /// \brief Running node of the iterator
   727       /// \brief Running node of the iterator
   728       ///
   728       ///
   729       /// Returns the running node of the iterator
   729       /// Returns the running node of the iterator
   730       Node runningNode(IncArcIt) const {
   730       Node runningNode(IncEdgeIt) const {
   731 	return INVALID;
   731 	return INVALID;
   732       }
   732       }
   733 
   733 
   734       template <typename Graph>
   734       template <typename Graph>
   735       struct Constraints {
   735       struct Constraints {