Graph Algorithms

Floyd-Warshall Algorithm

Find shortest paths between all pairs of nodes using dynamic programming. Handles negative edge weights (but not negative cycles).

Input Adjacency Matrix

Enter the number of nodes and the adjacency matrix (use ∞ or inf for no edge)

Enter numbers separated by spaces. Use ∞ or inf for infinity (no direct edge).

Trace

Step-by-step execution showing distance matrix updates at each iteration.

  1. Run the algorithm to populate steps.