public static void Main(String[] args) { GraphSearch g = new GraphSearch(9); g.AddEdge(0, 1); g.AddEdge(1, 2); g.AddEdge(2, 4); g.AddEdge(0, 4); g.AddEdge(4, 5); g.AddEdge(0, 3); g.AddEdge(3, 5); g.AddEdge(5, 6); g.AddEdge(5, 7); g.AddEdge(7, 2); g.AddEdge(6, 8); g.AddEdge(2, 8); g.AddEdge(1, 0); g.AddEdge(2, 1); g.AddEdge(4, 2); g.AddEdge(4, 0); g.AddEdge(5, 4); g.AddEdge(3, 0); g.AddEdge(5, 3); g.AddEdge(6, 5); g.AddEdge(7, 5); g.AddEdge(2, 7); g.AddEdge(8, 6); g.AddEdge(8, 2); Console.WriteLine("Поиск в глубину от вершины 0"); g.DeepFirstSearch(0); Console.Write("\n Поиск в ширину от вершины 0 \n"); g.BreadthFirstSearch(0); Console.WriteLine(); int[,] graph = new int[, ] { { 0, 6, 17, 11, 0, 0, 0, 0 }, { 6, 0, 0, 25, 0, 0, 0, 19 }, { 17, 0, 9, 0, 0, 0, 0, 0 }, { 11, 25, 8, 0, 2, 0, 0, 0 }, { 0, 0, 0, 2, 0, 21, 14, 0 }, { 0, 0, 0, 0, 21, 0, 0, 0 }, { 0, 0, 0, 0, 14, 0, 0, 9 }, { 0, 19, 0, 0, 0, 0, 9, 0 } }; Dijkstra t = new Dijkstra(); Console.WriteLine("\nАлгоритм Дейкстры для вершины 0"); t.DijkstraAlgorithm(graph, 0); Console.WriteLine(); int V = 9; int E = 12; Kruskals kruskals = new Kruskals(V, E); kruskals.edge[0].src = 0; kruskals.edge[0].dest = 1; kruskals.edge[0].weight = 2; kruskals.edge[1].src = 0; kruskals.edge[1].dest = 4; kruskals.edge[1].weight = 5; kruskals.edge[2].src = 0; kruskals.edge[2].dest = 3; kruskals.edge[2].weight = 3; kruskals.edge[3].src = 1; kruskals.edge[3].dest = 2; kruskals.edge[3].weight = 10; kruskals.edge[4].src = 2; kruskals.edge[4].dest = 4; kruskals.edge[4].weight = 2; kruskals.edge[5].src = 2; kruskals.edge[5].dest = 7; kruskals.edge[5].weight = 5; kruskals.edge[6].src = 2; kruskals.edge[6].dest = 8; kruskals.edge[6].weight = 6; kruskals.edge[7].src = 3; kruskals.edge[7].dest = 5; kruskals.edge[7].weight = 8; kruskals.edge[8].src = 4; kruskals.edge[8].dest = 5; kruskals.edge[8].weight = 7; kruskals.edge[9].src = 5; kruskals.edge[9].dest = 7; kruskals.edge[9].weight = 3; kruskals.edge[10].src = 5; kruskals.edge[10].dest = 6; kruskals.edge[10].weight = 4; kruskals.edge[11].src = 6; kruskals.edge[11].dest = 8; kruskals.edge[11].weight = 11; kruskals.KruskalAlgorithm(); Console.ReadLine(); }