src/lemon/concept/path.h
changeset 1272 17be4c5bc6c6
parent 1228 0a7719037acb
child 1282 81e89e2b90d1
equal deleted inserted replaced
5:eea151602ada 6:7fde4b81fd74
    34     //! \brief A skeleton structure for representing directed paths in a graph.
    34     //! \brief A skeleton structure for representing directed paths in a graph.
    35     //!
    35     //!
    36     //! A skeleton structure for representing directed paths in a graph.
    36     //! A skeleton structure for representing directed paths in a graph.
    37     //! \param GR The graph type in which the path is.
    37     //! \param GR The graph type in which the path is.
    38     //!
    38     //!
    39     //! In a sense, the path can be treated as a graph, for is has \c NodeIt
    39     //! In a sense, the path can be treated as a graph, for it has \c NodeIt
    40     //! and \c EdgeIt with the same usage. These types converts to the \c Node
    40     //! and \c EdgeIt with the same usage. These types converts to the \c Node
    41     //! and \c Edge of the original graph.
    41     //! and \c Edge of the original graph.
    42     template<typename GR>
    42     template<typename GR>
    43     class Path {
    43     class Path {
    44     public:
    44     public:
   170        *
   170        *
   171        * You can push new edges to the front and to the back of the path in
   171        * You can push new edges to the front and to the back of the path in
   172        * arbitrary order then you should commit these changes to the graph.
   172        * arbitrary order then you should commit these changes to the graph.
   173        *
   173        *
   174        * While the builder is active (after the first modifying
   174        * While the builder is active (after the first modifying
   175        * operation and until the call of \ref commit())
   175        * operation and until the call of \ref commit()) the
   176        * the underlining Path is in a
   176        * underlining Path is in a "transitional" state (operations on
   177        * "transitional" state (operations on it have undefined result).
   177        * it have undefined result).
   178        */
   178        */
   179       class Builder {
   179       class Builder {
   180       public:
   180       public:
   181 
   181 
   182         Path &P;
   182         Path &P;
   188 
   188 
   189 	/// Sets the starting node of the path.
   189 	/// Sets the starting node of the path.
   190 
   190 
   191 	/// Sets the starting node of the path. Edge added to the path
   191 	/// Sets the starting node of the path. Edge added to the path
   192 	/// afterwards have to be incident to this node.
   192 	/// afterwards have to be incident to this node.
   193 	/// You \em must start building an empry path with this functions.
   193 	/// You \em must start building an empty path with these functions.
   194 	/// (And you \em must \em not use it later).
   194 	/// (And you \em must \em not use it later).
   195 	/// \sa pushFront()
   195 	/// \sa pushFront()
   196 	/// \sa pushBack()
   196 	/// \sa pushBack()
   197 	void setStartNode(const GraphNode &) {}
   197 	void setStartNode(const GraphNode &) {}
   198 
   198 
   213 	///Commit the changes to the path.
   213 	///Commit the changes to the path.
   214 	void commit() {}
   214 	void commit() {}
   215 
   215 
   216 	///Reserve (front) storage for the builder in advance.
   216 	///Reserve (front) storage for the builder in advance.
   217 
   217 
   218 	///If you know an reasonable upper bound of the number of the edges
   218 	///If you know a reasonable upper bound on the number of the edges
   219 	///to add to the front of the path,
   219 	///to add to the front of the path,
   220 	///using this function you may speed up the building.
   220 	///using this function you may speed up the building.
   221 	void reserveFront(size_t r) {}
   221 	void reserveFront(size_t r) {}
   222 	///Reserve (back) storage for the builder in advance.
   222 	///Reserve (back) storage for the builder in advance.
   223 
   223 
   224 	///If you know an reasonable upper bound of the number of the edges
   224 	///If you know a reasonable upper bound on the number of the edges
   225 	///to add to the back of the path,
   225 	///to add to the back of the path,
   226 	///using this function you may speed up the building.
   226 	///using this function you may speed up the building.
   227 	void reserveBack(size_t r) {}
   227 	void reserveBack(size_t r) {}
   228       };
   228       };
   229     };
   229     };