Skip to content

[FEATURE] Modernize BGL shortest path algorithms #455

@Becheler

Description

@Becheler

The Sage Math graph module uses Boost Graph. This quick exploration comes from kind feedback from its maintainer David Coudert:

The BGL currently implements traditional (~1990) algorithms for shortest paths:

  • dijkstra_shortest_paths : 1959 single source, single shortest path tree, but constrained to positive weights
  • bellman_ford_shortest_paths : 1958 extends to negative weights with negative cycle detection
  • johnson_all_pairs_shortest_paths : 1977 combines bellman for reweighting with dijkstra running for each vertex
  • floyd_warshall_all_pairs_shortest_paths : 1962 better than johnson for dense graphs, uses dynamic programming
  • astar_search: 1968 single source to single target path, heuristically

But it lacks more modern algorithms:

  • Yen's algorithm (Yen 1971, cited ~500x) : k-shortest simple (loopless) paths between two vertices. At each iteration, finds the next shortest path by deviating from previously found paths. Baseline must-have
  • k-Shortest Simple Paths, Postponed Node Classification algorithm variant, (Al Zoobi et al 2023, cited ~13x) : best speed/memory tradeoff for finding k alternative paths, most performant
  • k-Shortest Simple Paths, SB* variant, (Al Zoobi et al 2023, cited ~13x) : fastest for small k, higher memory
  • Contraction Hierarchies (Geisberger et al., 2008, cited ~1200x) : amazing for road networks, 1000x+ speedup over Dijkstra
  • Hub labelling ( Abraham et al., 2011, cited ~400x) : sub-milliseconds shorttest path length oracle: avoids running dijsktra millions of times

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions