Reputation: 11
I have a list of points (x, y coordinates) and a list of connections between them. Examples:
Points A B C D E
Connections AB BC CE BD
D E
| |
A-B-C
Of course, there are many more points and connections than this...
What I need to do is find out the simplest path between some of these points. For example, if I wanted to go to A, C, and D, I'd want to use connections AB, BC, and BD.
Is there a way to compute this for any set of points I want to connect?
Upvotes: 1
Views: 306
Reputation: 26586
Since you don't indicate that there is any cost associated with the edges, a Breadth First Search is probably what you are looking for. It finds the shortest path from a given node to all other nodes (if any exist), I am assuming that is what you mean by 'simplest'.
Upvotes: 2