diff --git a/d5/d88/md__d_i_r_e_c_t_o_r_y.html b/d5/d88/md__d_i_r_e_c_t_o_r_y.html index 2aa021c5b..42733d5cf 100644 --- a/d5/d88/md__d_i_r_e_c_t_o_r_y.html +++ b/d5/d88/md__d_i_r_e_c_t_o_r_y.html @@ -232,6 +232,7 @@ Graph
|
+ Algorithms_in_C++ 1.0.0
+
+ Set of algorithms implemented in C++.
+ |
+
Travelling Salesman Problem implementation +More...
+#include <algorithm>#include <cassert>#include <iostream>#include <limits>#include <vector>+Namespaces | |
| namespace | graph |
| Graph Algorithms. | |
+Functions | |
| int | graph::TravellingSalesmanProblem (std::vector< std::vector< uint32_t > > *cities, int32_t src, uint32_t V) |
| Function calculates the minimum path distance that will cover all the cities starting from the source. More... | |
| static void | tests () |
| Self-test implementations. More... | |
| int | main () |
| Main function. More... | |
Travelling Salesman Problem implementation
+ +Travelling salesman problem asks: Given a list of cities and the distances between each pair of cities, what is the shortest possible route that visits each city exactly once and returns to the origin city? TSP can be modeled as an undirected weighted graph, such that cities are the graph's vertices, paths are the graph's edges, and a path's distance is the edge's weight. It is a minimization problem starting and finishing at a specified vertex after having visited each other vertex exactly once. This is the naive implementation of the problem.
+| int main | +( | +void | +) | ++ |
Main function.
+
+
|
+ +static | +
Self-test implementations.
+Graph Algorithms.
for std::vector
Graph algorithms.
for IO operations for std::set
-Graph Algorithms
+Graph Algorithms
+for std::min for assert for IO operations for limits of integral types for std::vector
| int graph::TravellingSalesmanProblem | +( | +std::vector< std::vector< uint32_t > > * | +cities, | +
| + | + | int32_t | +src, | +
| + | + | uint32_t | +V | +
| + | ) | ++ |
Function calculates the minimum path distance that will cover all the cities starting from the source.
+| cities | matrix representation of cities |
| src | Point from where salesman is starting |
| V | number of vertices in the graph |