Trait pathfinding::directed::edmonds_karp::EdmondsKarp
source · 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§
sourcefn new(size: usize, source: usize, sink: usize) -> Selfwhere
Self: Sized,
fn new(size: usize, source: usize, sink: usize) -> Selfwhere
Self: Sized,
Create a new empty structure.
§Panics
This function panics when source
or sink
is greater or equal than size
.
sourcefn from_matrix(source: usize, sink: usize, capacities: Matrix<C>) -> Selfwhere
Self: Sized,
fn from_matrix(source: usize, sink: usize, capacities: Matrix<C>) -> Selfwhere
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.
sourcefn common_mut(&mut self) -> &mut Common<C>
fn common_mut(&mut self) -> &mut Common<C>
Mutable common data.
sourcefn residual_successors(&self, from: usize) -> Vec<(usize, C)>
fn residual_successors(&self, from: usize) -> Vec<(usize, C)>
List of successors with positive residual capacity and this capacity.
sourcefn residual_capacity(&self, from: usize, to: usize) -> C
fn residual_capacity(&self, from: usize, to: usize) -> C
Residual capacity between two nodes.
sourcefn flows_from(&self, from: usize) -> Vec<usize>
fn flows_from(&self, from: usize) -> Vec<usize>
All positive flows starting from a node.
sourcefn add_flow(&mut self, from: usize, to: usize, capacity: C)
fn add_flow(&mut self, from: usize, to: usize, capacity: C)
Add a given flow between two nodes. This should not be used directly.
sourcefn add_residual_capacity(&mut self, from: usize, to: usize, capacity: C)
fn add_residual_capacity(&mut self, from: usize, to: usize, capacity: C)
Add some residual capacity.
Provided Methods§
sourcefn from_vec(source: usize, sink: usize, capacities: Vec<C>) -> Selfwhere
Self: Sized,
fn from_vec(source: usize, sink: usize, capacities: Vec<C>) -> Selfwhere
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.
sourcefn set_capacity(&mut self, from: usize, to: usize, capacity: C)
fn set_capacity(&mut self, from: usize, to: usize, capacity: C)
Set capacity between two nodes.
sourcefn total_capacity(&self) -> C
fn total_capacity(&self) -> C
Get total capacity.
sourcefn set_total_capacity(&mut self, capacity: C)
fn set_total_capacity(&mut self, capacity: C)
Set total capacity.
sourcefn omit_details(&mut self)
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.
sourcefn has_details(&self) -> bool
fn has_details(&self) -> bool
Are detailed flows and cuts requested?