Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Speedup route_search_all ~3x with vectorized updates of next matrix
Refactor the route_search_all method in RouteChoice to utilize NumPy's vectorized operations and boolean indexing, eliminating nested loops for updating the next matrix. This significantly enhances performance by reducing Python loop overhead in sparse graph computations. In a real-world road graph with 3275 links and 1552 nodes, it reduced the time route_search_all from ~0.85 seconds to ~0.30 seconds, a ~3x speedup. Together with the previous commit, it reduced the time route_search_all from ~19 seconds to ~0.3 seconds, a ~60x speedup.
- Loading branch information