themoffster
January 24th, 2005, 01:41 PM
I have a graph setup and working correctly - all nodes/edges etc are working correctly.
I am now trying to implement Dijkstra's shortest path algorithm.
After searching on Google, every example and piece of source code uses an adjecency matrix to represent the graph.
Why is this and how does it correspond to the graph? Surely it would be easier to just refer to the graph as a series of nodes and edges rather than creating this matrix.
How do you workout the matrix for a graph you have?
It's got me rather confused!
I am now trying to implement Dijkstra's shortest path algorithm.
After searching on Google, every example and piece of source code uses an adjecency matrix to represent the graph.
Why is this and how does it correspond to the graph? Surely it would be easier to just refer to the graph as a series of nodes and edges rather than creating this matrix.
How do you workout the matrix for a graph you have?
It's got me rather confused!