Skip to main content

bellman_ford

Function bellman_ford 

Source
pub fn bellman_ford(
    store: &LpgStore,
    source: NodeId,
    weight_property: Option<&str>,
) -> BellmanFordResult
Expand description

Runs Bellman-Ford algorithm from a source node.

Unlike Dijkstra, this algorithm handles negative edge weights and detects negative cycles.

§Arguments

  • store - The graph store
  • source - Starting node ID
  • weight_property - Optional property name for edge weights

§Returns

Distances, predecessors, and negative cycle detection flag.

§Complexity

O(V × E)