Work

Floyd–Warshall Algorithm for Sparse Graphs

Year: 2025
Type: article
Abstract: The Floyd–Warshall algorithm, which uses a classic dynamic programming approach, provides a solution to the all-pairs shortest paths problem. However, for sparse graphs, iteratively applying Dijkstra’s, or some other similar algorithm from each node, often proves to be more efficient. We introduce a novel technique based on a structural decomposition of the input graph into strongly connected components, allowing us to exploit the disconnectedness of the graph by avoiding redundant relaxation attempts on nodes that are not reachable from the source component. Using an empirical evaluation, where execution time is measured, we demonstrate that our approach outperforms existing alternatives on disconnected graphs.
Source: Algorithms
Language: English
Open Access status: gold
Estimated APC paid: $1,930
OpenAlex ID: W4417054814
FWCI: 0.496
Cites: 16
Cited by: 1
Related to: