I need to modify Dijkstra\'s algorithm so that if there are several shortest paths I need to find the one with minimum number of edges on the path.
I\'ve been stuck
inspired by BlueRaja
public void updateAdjacencyMatrix()
{
epsilon = 0.001
for (int i = 0; i < size; i++)
{
for (int j = 0; j < size; j++)
{
if (adjacencyMatrix[i, j] != 0)
adjacencyMatrix[i, j] = adjacencyMatrix[i, j] + epsilon;
}
}
}
then call updateAdjacencyMatrix() in your normal Dijkstra's implementation