I have a question on one of the previous Stack Overflow post @ Knight's Shortest Path on Chessboard
I understand the reply on 'ok, it's a graph question, and its sparse matrix is like':
(a1,b3)=1,
(a1,c2)=1,
.....
which describe existing edges. However i still don't know what Data Structure of this Graph should looks like (is it an adjacency matrix? stated as 'sparse matrix' above, or something else?), so that it can be readily used by Dijkstra's algorithm.
http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm.
From the algorithm description, it looks convenient if the graph data structure is a set of vertex, with neighbor vertex information available. But how do we achieve this?
How can I write out a sample data structure for this graph? I am seeking an understanding of how it can be linked conveniently to Dijkstra's algorithm.