Apex › Storage & databases

Floyd-Warshall all-pairs shortest paths

Shortest paths between every pair of vertices in one cubic dynamic program. Step through the intermediate vertices and watch the distance matrix relax — each cell taking the cheaper of what it had and routing through the current waypoint. Handles negative edges, and flags a negative cycle.

More in Storage & databases