In fact in the input of my program I have an n x n matrix containing the weights between 2 peaks (dist[i][j]=..) and my goal is both to seek the path + runs between couples peaks but also to retrieve the number of paths that connect them.
for now my code allows me to retrieve only the weight corresponding to the shortest path (in dist[i][j]) without the number of paths.
Code:
public double[][] getMinLenghts() {
//i and j are the start-finish vertices and k vertices is intermediate
// n is the number of peaks on the graph
for (k = 0; k < n; k++) {
for (i = 0; i < n; i++)
{
for (j = 0; j < n; j++)
{
//Floyd Warshall Algo
dist[i][j] = Math.min(dist[i][j], dist[i][k] + dist[k][j]);
....}
}
}
return dist;
}
Bookmarks