public void RunCycle(string path) { Digraph G = new Digraph(path); DirectedCycle c = new DirectedCycle(G); if (c.HasCycle()) { Console.WriteLine(string.Join("->", c.Cycle())); } else { Console.WriteLine("No cycle"); } }
public Topological(Digraph G) { DirectedCycle cycle = new DirectedCycle(G); if (!cycle.HasCycle()) { DepthFirstOrder dfo = new DepthFirstOrder(G); _order = dfo.ReversePost(); } else { Console.WriteLine(string.Join(",", cycle.Cycle())); } }