public void TopologicalOrderTest() { using (StreamReader sr = new StreamReader(@"E:\Study\ALG2017\ALGRKC\dataSelf\tinyDG.txt")) { Digraph dg = new Digraph(sr); TopologicalOrder tlOrder = new TopologicalOrder(dg); IEnumerable <int> order = tlOrder.Order(); foreach (int i in order) { Console.Write(i + " , "); } Console.WriteLine(); } }
public AcyclicSP(EdgeWeightedDiagraph ewg, int source) { edgeTo = new DirectedEdge[ewg.V()]; distTo = new double[ewg.V()]; for (int i = 0; i < ewg.V(); i++) { distTo[i] = double.PositiveInfinity; } distTo[source] = 0; TopologicalOrder tlOrder = new TopologicalOrder(ewg); foreach (int v in tlOrder.Order()) { Relax(ewg, v); } }