Floyd Warshall All Path Shortest Path - YaccConstructor/QuickGraph GitHub Wiki

Floyd Warshall All Path Shortest Path

The Floyd Warshall All Path Shortest Path finds all the shortest path in a weighted, directed path. It can also be used to detect negative cycles.

var g = ... ; // some graph of TVertex, TEdge
var weights = ... ; // a function that maps TEdge -> double
var fw = new FloydWarshallAllShortestPathAlgorithm<TVertex, TEdge>(g, weights);

// compute
fw.Compute();

// get interesting paths,
foreach(var source in g.Vertices)
    foreach(var target in g.Vertices)
    {
        IEnumerable<TEdge> path;
        if(fw.TryGetPath(source, target, out path)
            foreach(var edge in path)
                Console.WriteLine(edge);
    }
⚠️ **GitHub.com Fallback** ⚠️