项目作者: dilsonpereira

项目描述 :
C++ solution for the chinese postman problem
高级语言: C++
项目地址: git://github.com/dilsonpereira/chinese-postman-problem.git
创建时间: 2018-06-29T20:14:33Z
项目社区:https://github.com/dilsonpereira/chinese-postman-problem

开源协议:

下载


A C++ solution for the chinese postman problem

To clone the repo and its dependencies (submodules):

  1. git clone --recursive https://github.com/dilsonpereira/chinese-postman-problem

Compilation on Linux:

  1. make chinese

Usage:

  1. ./chinese -f <inputFile>

File format:

The first two lines give n (number of vertices) and m (number of edges). Each of the next m lines has a tuple (u, v, c) representing an edge, where u and v are the endpoints (0-based indexing) of the edge and c is its cost.

Sample input:

  1. 10
  2. 15
  3. 0 1 1
  4. 0 4 3
  5. 1 2 0
  6. 1 4 10
  7. 2 3 9
  8. 2 5 2
  9. 2 6 7
  10. 3 6 3
  11. 4 5 4
  12. 4 7 2
  13. 5 7 6
  14. 6 8 4
  15. 6 9 2
  16. 7 8 1
  17. 8 9 5

Sample output:

  1. Solution cost: 62
  2. Solution:
  3. 0 4 7 8 9 6 3 2 6 8 7 5 2 1 2 5 4 1 0

See Example.cpp to learn how to use the library.

Feel free to contact me if you have any problem.