tsp_tour_len_visitor :: Boost.Graph Documentation

# tsp_tour_len_visitor

Records the vertices of a TSP tour into an output iterator and computes the total tour length.

Defined in: `<boost/graph/metric_tsp_approx.hpp>`
Models: TSP Tour Visitor

## Usage

    double total_length = 0.0;
    std::vector<Vertex> tour;
    metric_tsp_approx(g, get(edge_weight, g),
                      make_tsp_tour_len_visitor(g, std::back_inserter(tour),
                                               total_length, get(edge_weight, g)));
    std::cout << "Tour length: " << total_length << "\n";

## Synopsis

    template <typename Graph, typename WeightMap,
              typename OutputIterator, typename Length>
    struct tsp_tour_len_visitor;

    template <typename Graph, typename WeightMap,
              typename OutputIterator, typename Length>
    tsp_tour_len_visitor<Graph, WeightMap, OutputIterator, Length>
    make_tsp_tour_len_visitor(const Graph& g, OutputIterator iter,
                              Length& len, WeightMap wmap);

## Parameters

Parameter | Description
--- | ---
`Graph` | The graph type.
`WeightMap` | ReadablePropertyMap. Key type is edge descriptor.
`OutputIterator` | Output iterator that receives vertex descriptors of the tour.
`Length` | Numeric type supporting `+=`. Accumulates the total tour length. Passed by reference.