Ejemplo n.º 1
0
 public void DFS()
 {
     _graph.Generate(_moduleConfigurations);
     _graph.DFS();
     Assert.NotNull(_graph.Vertices);
     _graph.Vertices.ForEach(v => {
         Assert.IsTrue(v.Color == Color.Black);
     });
 }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            var txt   = System.IO.File.ReadAllText("C:\\source_code\\azure-virtual-datacenter\\topological-sort\\tests\\samples\\moduleConfigurations.json");
            var graph = new DirectedGraph();

            graph.Generate(txt);

            Console.WriteLine(JsonConvert.SerializeObject(graph.Vertices));
            Console.WriteLine(Environment.NewLine);
            Console.WriteLine(Environment.NewLine);

            graph.DFS();

            Console.WriteLine(JsonConvert.SerializeObject(graph.Vertices));

            Console.WriteLine(JsonConvert.SerializeObject(graph.Vertices));
            Console.WriteLine(Environment.NewLine);
            Console.WriteLine(Environment.NewLine);

            Console.WriteLine(JsonConvert.SerializeObject(graph.TopologicalSort));
        }