Program.cs
/// <summary>
/// Use Floyd-Warshalls algorthim for finding the min distance
/// for each vertices pair
/// </summary>
/// <param name="distanceMatrix"></param>
Use Floyd-Warshalls algorthim for finding the min distance
for each vertices pair
Use Floyd - Warshalls algorthim for finding the min distance for each vertices pair
static void CalcShortestDistances(int[,] distanceMatrix)
        {
            var size = vertices.Length;
            for (var k = 0; k < size; k++)
                for (var i = 0; i < size; i++)
                    for (var j = 0; j < size; j++)
                        distanceMatrix[i, j] = Math.Min(distanceMatrix[i, j], distanceMatrix[i, k] + distanceMatrix[k, j]);
        }
static void CalcShortestDistances ( int [ , ] distanceMatrix ) { var size = vertices . Length ; for ( var k = 0 ; k < size ; k ++ ) for ( var i = 0 ; i < size ; i ++ ) for ( var j = 0 ; j < size ; j ++ ) distanceMatrix [ i , j ] = Math . Min ( distanceMatrix [ i , j ] , distanceMatrix [ i , k ] + distanceMatrix [ k , j ] ) ; }
Use Floyd-Warshalls algorthim for finding the min distance
for each vertices pair
Use Floyd - Warshalls algorthim for finding the min distance for each vertices pair
// Floyd-Warshalls algorithm
distanceMatrix
int[,]
None