Please note, that wiki documentation doesn't works and I don't know how to use it.
I downloaded source code and I review Dijkstra test and examples but it doesn't cover everything that I have to do.
I created a Node class that contains some information that it is not useful for the Dijkstra's algorithm. Also, I created a Arc Class that implements IEdge<NodeClass>
Source // Target properties are implemented
So, Following step is to create an AdjacencyGraph as follows:
AdjacencyGraph<Node,Arc> graph = new AdjacencyGraph<Node, Arc>(true);
After that I create origin and target node, also I create an edge object that references to origin and target and EdgeCost that also reference to Edge
Node source = xxxx;
Node target = xxxx;
Arc objectArc = new Arc(source,target);
When the graph has been created, program shall execute following senteces:
DijkstraShortestPathAlgorithm<Node, Arc> dijkstra = new DijkstraShortestPathAlgorithm<Node, Arc>(graph, edgeCost);
// Attach a Vertex Predecessor Recorder Observer to give us the paths
predecessorObserver = new VertexPredecessorRecorderObserver<Node, Arc>();
using (ObserverScope.Create<IVertexPredecessorRecorderAlgorithm<Node, Arc>>(dijkstra, predecessorObserver))
// Run the algorithm with A set to be the source
Dijkstra is computed and predecessorObserver only contains one Node, the first node. There are more than 3.800 nodes and 2.000 edges created in the graph
Also, I would like to know what is the main function of VertexPredecessorObserver. I',m get lost.
Thank you so much
Sep 8, 2008 at 3:26 PM
Can you confirm that your graph is correctly correct by:
- enumerating the out edges of the first node, it should have some.
- running a depth first search instead of dijkstra (using the same vertex predecessor recorder) and see if anything gets recorded in there.
The dijkstra algorithm is just a graph traversal. The vertex predecessor recorder records particular events during the traversal. This mechanism is used to compose different algorithm with different recorders.