Skip to main content

build_level_graph

Function build_level_graph 

Source
fn build_level_graph<G>(
    network: G,
    source: G::NodeId,
    destination: G::NodeId,
    flows: &[G::EdgeWeight],
    level_edges: &mut [Vec<G::EdgeRef>],
) -> Vec<usize>
Expand description

Makes a BFS that labels network vertices with levels representing their distance to the source vertex, considering only edges with positive residual capacity.

The source vertex is labeled as 1, and vertices not reachable are labeled as 0.

Aggregates in level_edges the edges that connects each vertex to its neighbours in the next level.

Returns the computed level graph.