示例#1
0
文件: Program.cs 项目: Miltt/Console
        static void Main(string[] args)
        {
            Graph graph = new Graph();
            graph.AddEdge(0, 1);
            graph.AddEdge(0, 2);
            graph.AddEdge(1, 3);
            graph.AddEdge(2, 3);
            graph.AddEdge(2, 4);
            graph.AddEdge(3, 4);

            DeepFirstSearch dfs = new DeepFirstSearch(graph);
            dfs.Run(graph.Vertices.First());

            Console.WriteLine("Press any key...");
            Console.ReadKey();
        }
示例#2
0
文件: Program.cs 项目: Miltt/Console
 public DeepFirstSearch(Graph graph)
 {
     this.graph = graph;
     traversedVertex = new bool[graph.Vertices.Count()];
 }