MATLAB Answers

Traverse a directed graph visiting all edges at least once?

42 views (last 30 days)
Michael Bockwoldt
Michael Bockwoldt on 24 Mar 2021
Commented: Christine Tobler on 25 Mar 2021
I am working on a project utilizing the Chinese Postman Problem where I want to find the shortest path in a directed matrix that visits each edge at least once starting from a specified node. Are there any Graph Theory functions that deal with this kind of problem?

Answers (1)

Christine Tobler
Christine Tobler on 24 Mar 2021
There aren't any functions for MATLAB's graph object that solve this problem. Possibly you can formulate this as an optimization problem? See https://www.mathworks.com/help/optim/ug/traveling-salesman-problem-based.html for an example of how to solve the related Traveling Salesman Problem using the optimization toolbox.
  4 Comments
Christine Tobler
Christine Tobler on 25 Mar 2021
This could be used to solve the Traveling Salesman problem (not efficiently), but not for the variant your looking for.
Here I'm just going through all possible ways of visiting each node exactly once, and then taking the minimum of that large set of possibilities. But when nodes can be visited many times, there's no way to just write up all possible orders of visiting the nodes, there are infinitely many ways to do this.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!