lemon/christofides_tsp.h
changeset 1051 4f9a45a6d6f0
parent 1036 dff32ce3db71
child 1074 97d978243703
equal deleted inserted replaced
3:b3ee690a550a 4:813384c2da19
   207       }
   207       }
   208 
   208 
   209       /// \brief Gives back the node sequence of the found tour.
   209       /// \brief Gives back the node sequence of the found tour.
   210       ///
   210       ///
   211       /// This function copies the node sequence of the found tour into
   211       /// This function copies the node sequence of the found tour into
   212       /// the given standard container.
   212       /// an STL container through the given output iterator. The
   213       ///
   213       /// <tt>value_type</tt> of the container must be <tt>FullGraph::Node</tt>.
   214       /// \pre run() must be called before using this function.
   214       /// For example,
   215       template <typename Container>
   215       /// \code
   216       void tourNodes(Container &container) const {
   216       /// std::vector<FullGraph::Node> nodes(countNodes(graph));
   217         container.assign(_path.begin(), _path.end());
   217       /// tsp.tourNodes(nodes.begin());
       
   218       /// \endcode
       
   219       /// or
       
   220       /// \code
       
   221       /// std::list<FullGraph::Node> nodes;
       
   222       /// tsp.tourNodes(std::back_inserter(nodes));
       
   223       /// \endcode
       
   224       ///
       
   225       /// \pre run() must be called before using this function.
       
   226       template <typename Iterator>
       
   227       void tourNodes(Iterator out) const {
       
   228         std::copy(_path.begin(), _path.end(), out);
   218       }
   229       }
   219       
   230       
   220       /// \brief Gives back the found tour as a path.
   231       /// \brief Gives back the found tour as a path.
   221       ///
   232       ///
   222       /// This function copies the found tour as a list of arcs/edges into
   233       /// This function copies the found tour as a list of arcs/edges into