In gplot or any graphing program how would I be able to determine if a path exists between two points

1 view (last 30 days)
For example A is connected to B, B to C, C to D, and E is connected to F. I want to ask if A is connected to F. The answer should be no. If I say is A connected to D? the answer should be yes.

Answers (1)

Walter Roberson
Walter Roberson on 18 Jan 2013
You would not do it in a graphing program; you would use the data that was used to construct the graph.
If you want to know what the path is, you would use something like Dijkstra's Shortest Path algorithm.
If you just want to know whether there is a path, then there is a set partitioning algorithm that can be more efficient.
But those are graph theory questions, not MATLAB questions.
  1 Comment
Robert
Robert on 18 Jan 2013
Thank you for your response. I would prefer not to use Dijkstra's Shortest Path algorithm since I just want to check whether or not there is a path. How would I use the set partitioning algorithm?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!