Fhnw.Ecnf.RoutePlanner.RoutePlannerLib.RoutesFloydWarshall.InitializeWeight C# (CSharp) Method

InitializeWeight() private method

private InitializeWeight ( List cities, List links ) : ].double[
cities List
links List
return ].double[
        private double[,] InitializeWeight( List<City> cities, List<Link> links )
        {
            double[,] weight = new double[cities.Count, cities.Count];
            // initialize with MaxValue:
            for (int i = 0; i < cities.Count; i++)
            {
                for (int j = 0; j < cities.Count; j++)
                {
                    weight[i, j] = Double.MaxValue;
                }
            }

            foreach( Link e in links )  {
                weight[e.FromCity.Index,e.ToCity.Index] = e.Distance;
                weight[e.ToCity.Index,e.FromCity.Index] = e.Distance;
            }
            return weight;
        }