I have created this algorithm as to get the shortest point between two selected points on a map.
First I filled the matrix entirely with the distance, weight. I named it so that for example: dist[0,1] refers to the road between point 0 and point 1. Every point has a number assigned to it.
The matrix is all filled accordingly and then the Fjord Warshall Algorithm runs:
for (int k = 0; k < count; ++k)
{
for (int i = 0; i < count; ++i)
{
for (int j = 0; j < count; ++j)
{
if (dist[i,j] > (dist[i,k]+dist[k,j]))
{
dist[i, j] = dist[i, k] + dist[k, j];
}
}
}
}
This derives the shortest point between every single path. I then check the path that I have as to get it's shortest point:
shortest = dist[x, y];
Which return the correct value and everything works well. Here is my issue. I need to set it as to see through which points it passes. By this I mean that if I want to go from Point 1 to point 5 and the shortest route is through 3 and 6, it would display 1,3,6,5.
Any ideas? Completely stuck on this one.