Floyd–Warshall algorithm Class All-pairs shortest path problem (for weighted graphs) Data structure Graph Worst-case performance Θ ( | V | 3 ) {\displaystyle \Theta (|V|^{3})} Best-case performance Θ ( | V | 3 ) {\displaystyle \Theta (|V|^{3})} Average performance Θ ( | V | 3 ) {\displaystyle \Theta (|V|^{3})} Worst-case space complexity Θ ( | V | 2 ) {\displaystyle \Theta (|V|^{2})}