Rank: 78141 based on 0 downloads (last 30 days) and 0 file submitted
photo

m

E-mail

Personal Profile:
Professional Interests:

 

Watch this Author's files

 

Comments and Ratings by m
Updated File Comments Rating
18 Jan 2010 MatlabBGL MatlabBGL provides robust and efficient graph algorithms for Matlab using native data structures. Author: David Gleich

"How can I get the shortest path between nodes s and t? What I'm looking for is list of nodes, not just the distance..."

Use the predecessors returned by the shortest_paths function.
For example:

load graphs/clr-25-2.mat
startnode = 1;
endnode = 5;
[d pred] = shortest_paths(A,startnode);

cur = endnode;
path = [];
while(true)
path = [cur path];
if cur == startnode
break;
end
cur = pred(cur);
end

In this example, path = [1 3 5], which represents the shortest path from node 1 to node 5.

Contact us