Models | Examples |
---|---|
Display ads | Yahoo! |
Search ads |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Wikipedia: a graph analysis algorithm for finding shortest paths in a weighted graph | |
// (with positive or negative edge weights) and also for finding transitive closure of a | |
// relation R. A single execution of the algorithm will find the lengths (summed weights) | |
// of the shortest paths between all pairs of vertices, though it does not return details | |
// of the paths themselves. The algorithm is an example of dynamic programming. | |
public void floyd(int n, int[][] W, int[][] P, int[][] D) | |
{ | |
D = W; | |
for (int i = 0; i<n; i++) |