Find All Possible Paths from a Single SourceNode to a Single TargetNode Without Visiting Old Paths

7 views (last 30 days)
czeslaw
czeslaw on 29 Jan 2018
Edited: czeslaw on 29 Jan 2018
Hi All,
If I have node set nodeset=[nodeID x y] of size numberOfNodes x 3. I also have undirected path pathset=[PathID nodeID1 nodeID2] of size PathID x 3. I would like to find all possible paths from a single sourceNode to a single TargetNode. Visiting the previously travelled edge (path) is not allowed because there would be too much solutions. Visiting the previously travelled vertices are allowed.
Is there a function out there in Matlab that can help me do this: Example: AllPaths(nodeset, pathset, sourceNode, TargetNode) output: sets of vector containing PathID's that gives those possible path.
Your help much appreciated. Thank you in advance.
  2 Comments
Steven Lord
Steven Lord on 29 Jan 2018
If like the person Walter remembers who asked the similar question a couple months ago you're trying to investigate centrality of a graph or digraph, take a look at the centrality function.

Sign in to comment.

Answers (1)

czeslaw
czeslaw on 29 Jan 2018
Edited: Walter Roberson on 29 Jan 2018
Thank you all for the reply,
In response to Walter, for instance, if I have paths following a square figure with a diagonal in the middle, there will be 3 ways to go from point A to points C.
So if I input AllPaths(nodeset, pathset, A, C), the function that I looked for should output:
1. A B C
2. A C
3. A D C
I am not certain about that centrality function, would it be helpful for this kind of example. Any suggestions would be much appreciated. Thank you.
  6 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!