public static void Filling(this EdgeWeightedDigraph ewg, int count) { for (int i = 0; i < count - 1; i++) { int k = i + 1; double weight = (i + k) * (double)count / 100; ewg.addEdge(new DirectedEdge(i, i + 1, weight)); } for (int i = 0; i < count - 2; i++) { int k = i + 2; double weight = (i + k) * (double)count / 100; ewg.addEdge(new DirectedEdge(i, i + 2, weight)); } }
private void findNegativeCycle() { int V = edgeTo.Length; EdgeWeightedDigraph spt; spt = new EdgeWeightedDigraph(V); for (int v = 0; v < V; v++) if (edgeTo[v] != null) spt.addEdge(edgeTo[v]); DirectedCycle cf = new DirectedCycle(spt); cycle = cf.Cycle(); }
private void findNegativeCycle() { int V = edgeTo.Length; EdgeWeightedDigraph spt; spt = new EdgeWeightedDigraph(V); for (int v = 0; v < V; v++) { if (edgeTo[v] != null) { spt.addEdge(edgeTo[v]); } } DirectedCycle cf = new DirectedCycle(spt); cycle = cf.Cycle(); }