Here's an implementation of Djisktra's algorithm in MATLAB for finding the shortest path between two nodes in a graph.
main.m1171 chars41 lines
Note that the input graph should be a weighted adjacency matrix, where the distance between nodes is represented by the weight of their edge. The algorithm returns both the shortest path as an array of node indices and the total distance traveled.
gistlibby LogSnag