pub trait EdmondsKarp<C: Copy + Zero + Signed + Ord + Bounded> {
Show 21 methods // Required methods fn new(size: usize, source: usize, sink: usize) -> Self where Self: Sized; fn from_matrix(source: usize, sink: usize, capacities: Matrix<C>) -> Self where Self: Sized; fn common(&self) -> &Common<C>; fn common_mut(&mut self) -> &mut Common<C>; fn residual_successors(&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>; 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); // Provided methods 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_details(&mut self) { ... } fn has_details(&self) -> bool { ... } fn augment(&mut self) -> EKFlows<usize, C> { ... }
}
Expand description

Representation of capacity and flow data.

Required Methods§

source

fn new(size: usize, source: usize, sink: usize) -> Self
where Self: Sized,

Create a new empty structure.

§Panics

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

source

fn from_matrix(source: usize, sink: usize, capacities: Matrix<C>) -> Self
where Self: Sized,

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, or it the matrix is not a square one.

source

fn common(&self) -> &Common<C>

Common data.

source

fn common_mut(&mut self) -> &mut Common<C>

Mutable common data.

source

fn residual_successors(&self, from: usize) -> Vec<(usize, C)>

List of successors with positive residual capacity and this capacity.

source

fn residual_capacity(&self, from: usize, to: usize) -> C

Residual capacity between two nodes.

source

fn flow(&self, from: usize, to: usize) -> C

Flow between two nodes.

source

fn flows_from(&self, from: usize) -> Vec<usize>

All positive flows starting from a node.

source

fn flows(&self) -> Vec<((usize, usize), C)>

All flows between nodes.

source

fn add_flow(&mut self, from: usize, to: usize, capacity: C)

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

source

fn add_residual_capacity(&mut self, from: usize, to: usize, capacity: C)

Add some residual capacity.

Provided Methods§

source

fn from_vec(source: usize, sink: usize, capacities: Vec<C>) -> Self
where Self: Sized,

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.

source

fn size(&self) -> usize

Number of nodes.

source

fn source(&self) -> usize

Source.

source

fn sink(&self) -> usize

Sink.

source

fn set_capacity(&mut self, from: usize, to: usize, capacity: C)

Set capacity between two nodes.

source

fn total_capacity(&self) -> C

Get total capacity.

source

fn set_total_capacity(&mut self, capacity: C)

Set total capacity.

source

fn omit_details(&mut self)

Do not request the detailed flows and cuts as a result. The returned flows and cuts will be empty vectors.

source

fn has_details(&self) -> bool

Are detailed flows and cuts requested?

source

fn augment(&mut self) -> EKFlows<usize, C>

Compute the maximum flow and minimum cut.

Implementors§