Esempio n. 1
0
        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();
        }
Esempio n. 2
0
 public DeepFirstSearch(Graph graph)
 {
     this.graph = graph;
     traversedVertex = new bool[graph.Vertices.Count()];
 }