The graph-tool library appears to be much faster than csgraph.bellman_ford_search for running the Bellman-Ford algorithm. However, installing graph-tool can be a bit challenging, and it is not well supported on Windows. For this reason, I have added graph-tool as an optional dependency rather than a required one. In terms of speed, the following code demonstrates that graph-tool is approximately 5 times faster than the default implementation. In 3D, I have found the speed difference to be even greater (see here)
The
graph-tool
library appears to be much faster thancsgraph.bellman_ford_search
for running the Bellman-Ford algorithm. However, installinggraph-tool
can be a bit challenging, and it is not well supported on Windows. For this reason, I have added graph-tool as an optional dependency rather than a required one. In terms of speed, the following code demonstrates thatgraph-tool
is approximately 5 times faster than the default implementation. In 3D, I have found the speed difference to be even greater (see here)Speed-wise:
Default run: 16.17208695411682 graph-tool: 3.133636713027954
I've also added a test file. I hope it helps.