Trait pathfinding::EdmondsKarp [] [src]

pub trait EdmondsKarp<C: Copy + Zero + Signed + Ord + Bounded> {
    fn new(size: usize, source: usize, sink: usize) -> Self
    where
        Self: Sized
;
fn from_matrix(
        source: usize,
        sink: usize,
        capacities: SquareMatrix<C>
    ) -> Self
    where
        Self: Sized
;
fn common(&self) -> &Common<C>;
fn common_mut(&mut self) -> &mut Common<C>;
fn residual_neighbours(&self, from: usize) -> Vec<(usize, C)>;
fn residual_capacity(&self, from: usize, to: usize) -> C;
fn flow(&self, from: usize, to: usize) -> C;
fn flows_from(&self, from: usize) -> Vec<(usize, C)>;
fn flows(&self) -> Vec<((usize, usize), C)>;
fn add_flow(&mut self, from: usize, to: usize, capacity: C);
fn add_residual_capacity(&mut self, from: usize, to: usize, capacity: C); fn from_vec(source: usize, sink: usize, capacities: Vec<C>) -> Self
    where
        Self: Sized
, { ... }
fn size(&self) -> usize { ... }
fn source(&self) -> usize { ... }
fn sink(&self) -> usize { ... }
fn set_capacity(&mut self, from: usize, to: usize, capacity: C) { ... }
fn total_capacity(&self) -> C { ... }
fn set_total_capacity(&mut self, capacity: C) { ... }
fn omit_detailed_flows(&mut self) { ... }
fn detailed_flows(&self) -> bool { ... }
fn augment(&mut self) -> EKFlows<usize, C> { ... }
fn cancel_flow(&mut self, from: usize, to: usize, capacity: C) { ... } }

Representation of capacity and flow data.

Required Methods

Create a new empty structure.

Panics

This function panics when source or sink is greater or equal than size.

Create a new populated structure.

Panics

This function panics when source or sink is greater or equal than the number of rows in the capacities matrix.

Common data.

Mutable common data.

List of neighbours with positive residual capacity and this capacity.

Residual capacity between two nodes.

Flow between two nodes.

All positive flows starting from a node.

All flows between nodes.

Add a given flow between two nodes. This should not be used directly.

Add some residual capacity.

Provided Methods

Create a new populated structure.

Panics

This function panics when source or sink is greater or equal than the number of rows in the square matrix created from the capacities vector.

Number of nodes.

Source.

Sink.

Set capacity between two nodes.

Get total capacity.

Set total capacity.

Do not request the detailed flows as a result. The returned flows will be an empty vector.

Are detailed flows requested?

Compute the maximum flow.

Internal: cancel a flow capacity between two nodes.

Implementors