public List <string> Result(int k, int N, int[][] arr) { Point[] v = new Point[N]; for (int i = 0; i < N; i++) { if (i == k) { v[i] = new Point(0, false, Convert.ToString(i)); } else { v[i] = new Point(9999, false, Convert.ToString(i)); } } int M = arr.Length; Rebro[] rebras = new Rebro[M]; for (int i = 0; i < M; i++) { rebras[i] = new Rebro(v[arr[i][0]], v[arr[i][1]], arr[i][2]); } DekstraAlgoritm da = new DekstraAlgoritm(v, rebras); da.AlgoritmRun(v[k]); List <string> b = PrintGraph.PrintAllPoints(da); return(b); }
public static List <string> PrintAllPoints(DekstraAlgoritm da) { List <string> retListOfPoints = new List <string>(); foreach (Point p in da.points) { retListOfPoints.Add(string.Format("до {0} равно {1}", p.Name, p.ValueMetka)); } return(retListOfPoints); }