AdjacencyGraph - Undirected

Topics: algorithm, graph
Mar 17, 2009 at 1:42 AM
Hi.
I'm trying to use Dijkstra on an AdjacencyGraph in a University project.
Imagine I have one graph with only two nodes: u and v.
Dijkstra gives me the route between u and v but if I ask it to give me the route between v and u, the Access variable returns false.
What am I doing wrong? Thanks.

Code below:

 

DijkstraShortestPathAlgorithm<string, Edge<string>> dijkstra = new DijkstraShortestPathAlgorithm<string, Edge<string>>(graph, AlgorithmExtensions.GetIndexer<Edge<string>, double>(edgeCost));
VertexPredecessorRecorderObserver<string, Edge<string>> predecessorObserver = new VertexPredecessorRecorderObserver<string, Edge<string>>();
predecessorObserver.Attach(dijkstra);
(...)
dijkstra.Compute(RouterFrom);
(...)
Access = predecessorObserver.TryGetPath(RouterTo, out path);

 

Mar 23, 2009 at 11:57 PM
Sorry for the late reply. Other projects caught my attention...
Thank you very much. This really helped.
What I needed was some guidance.

Now I'm trying to develop a way to find the best weight configuration so the "flow" that goes through the graph is the best.
Like routing OSPF weight optimization... :)
Just digging into it.

Thanks again and congratulations for the great coding.