Reputation: 297
I'm trying to find a library for iPhone app that can represent a network with an arbitrary number of nodes and distances between the nodes. I need to then calculate shortest path between the nodes. Does anyone know if such is available for objective-c or c++ in general that can be used in an iPhone app?
Thanks
Upvotes: 0
Views: 97
Reputation: 11320
If it's a simple enough network, you can just do a normal BFS (Breadth-First Search) or DFS (Depth-First Search) and compute all the possible paths. Then just select the fastest one. Remember, for graphs you have to store a list of nodes that you've already visited, otherwise you'll end up going in circles forever.
Upvotes: 1