/// <summary> /// Compute the All shortest path problem. /// </summary> public void Compute() { this.definedPaths = new Hashtable(); // initialize distance map foreach (IVertex i in VisitedGraph.Vertices) { foreach (IVertex j in VisitedGraph.Vertices) { if (VisitedGraph.ContainsEdge(i, j)) { DefinedPaths.Add(new VertexPair(i, j), null); } OnInitiliazePath(i, j); } } // iterate foreach (IVertex k in VisitedGraph.Vertices) { foreach (IVertex i in VisitedGraph.Vertices) { if (DefinedPaths.Contains(new VertexPair(i, k))) { foreach (IVertex j in VisitedGraph.Vertices) { OnProcessPath(i, j, k); bool defkj = DefinedPaths.Contains(new VertexPair(k, j)); bool defij = DefinedPaths.Contains(new VertexPair(i, j)); if (defkj && (defij || Tester.Test(i, j, k))) { DefinedPaths[new VertexPair(i, j)] = null; OnReducePath(i, j, k); } else { OnNotReducePath(i, j, k); } } } } } }