pub struct EdmondsKarp { /* private fields */ }Expand description
Edmonds-Karp maximum flow algorithm.
Uses BFS to find shortest augmenting paths (Ford-Fulkerson with BFS). Time complexity: O(V E²).
§Example
use scirs2_graph::flow::max_flow::EdmondsKarp;
let mut ek = EdmondsKarp::new(4);
ek.add_edge(0, 1, 10);
ek.add_edge(0, 2, 10);
ek.add_edge(1, 3, 10);
ek.add_edge(2, 3, 10);
let flow = ek.max_flow(0, 3);
assert_eq!(flow, 20);Implementations§
Trait Implementations§
Source§impl Clone for EdmondsKarp
impl Clone for EdmondsKarp
Source§fn clone(&self) -> EdmondsKarp
fn clone(&self) -> EdmondsKarp
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for EdmondsKarp
impl RefUnwindSafe for EdmondsKarp
impl Send for EdmondsKarp
impl Sync for EdmondsKarp
impl Unpin for EdmondsKarp
impl UnsafeUnpin for EdmondsKarp
impl UnwindSafe for EdmondsKarp
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more