using System.Collections.Generic;
using System.Threading.Tasks;
public void FIND(string start, string[,] Gr, int[,] G)
int[,] A = new int[6, 6];
int count = myuuu.S(2, start, Gr);
for (int i = 0; i < G.GetLength(1); i++)
A[count, i] = G[count, i];
Console.WriteLine("Путь от start до вершины {0} = {1}",i,A[count,i]);
C[0] = count; C[1] = UUU.count2;
public int[] Pr(int[,] G, int[,] A, int[] C)
int count = C[0]; UUU.count2 = C[1];
for (int i = 0; i < G.GetLength(1); i++)
if (G[count, i] != 0&&i!=UUU.count2)
A[count, i] = G[count, i] + A[UUU.count2, i];
Console.WriteLine("Путь от А до вершины {0} = {1}", i, A[count, i]);
C[0] = count; C[1] = UUU.count2;
public int S(int s, string start, string[,] Gr)
for (int i = 0; i < Gr.GetLength(1); i++)
static void Main(string[] args)
string[,] Gr = { { "#", "A", "B" , "C" , "D" , "E" },
{ "A", "0", "9" , "-" , "6" , "-" },
{ "B", "9", "0", "5" , "-", "-" },
{ "C", "-" , "5" , "0", "2", "1" },
{ "D", "6", "-", "-", "0", "4"},
{ "E", "-", "-" , "1" , "4", "0" }, };
int[,] G = { { 0, 0, 0 , 0 , 0 , 0 },
Console.WriteLine("Введите начальную вершину");
string start = Console.ReadLine();
myuuu.FIND(start, Gr, G);