public EdgeWeightedTopological(EdgeWeightedDigraph g) { var cycleFinder = new EdgeWeightedDirectedCycle(g); if (!cycleFinder.HasCycle()) { var dfs = new EdgeWeightedDigraphDepthFirstOrder(g); order = dfs.ReversePost(); } }
private void findNegativeCycle() { int vcount = edgeTo.Length; var spt = new EdgeWeightedDigraph(vcount); for (int i = 0; i < vcount; i++) { if (edgeTo[i] != null) { spt.AddEdge(edgeTo[i]); } } var cf = new EdgeWeightedDirectedCycle(spt); cycle = cf.GetCycle(); }