Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Floyd Warshall reconstruct path

Tags:

path

graph

I want to reconstruct the path from source to destination vertex in this graph problem.

How can I store the path, and how can I retrieve it after I have found the minimal cost from s to d?

Please help me to find a simple answer?

For example at the point,

adjmat[i][j] = Math.min(adjMat[i][j],adjMat[i][k]+adjMat[k][j]);

I need to add a path and I need to retrieve it.

like image 423
CosmoRied Avatar asked May 03 '11 07:05

CosmoRied


1 Answers

The Wikipedia article about the Floyd-Warshall algorithm provides an explanation and pseudocode for your problem.

like image 200
Patrick Spettel Avatar answered Oct 18 '22 10:10

Patrick Spettel