예제 #1
0
            public static void Main()
            {
                Graph g = new Graph(10);

                g.AddEdge(1, 2);
                g.AddEdge(1, 3);
                g.AddEdge(2, 4);
                g.AddEdge(3, 5);
                g.AddEdge(3, 6);
                g.AddEdge(4, 7);
                g.AddEdge(5, 5);

                GraphPractice obj = new GraphPractice();

                obj.BreadthFirstSearch(g, 1);
                Console.ReadLine();
            }
예제 #2
0
            public static void Main()
            {
                Graph g = new Graph(10);

                g.AddEdge(1, 2);
                g.AddEdge(1, 3);
                g.AddEdge(2, 4);
                g.AddEdge(3, 5);
                g.AddEdge(3, 6);
                g.AddEdge(4, 7);
                g.AddEdge(5, 7);
                g.AddEdge(5, 8);
                g.AddEdge(5, 6);
                g.AddEdge(8, 9);
                g.AddEdge(9, 10);

                GraphPractice obj = new GraphPractice();

                obj.BFS_Graph_Path_To_Node(g, 7, 10);
                Console.ReadLine();
            }