Struct rs_graph::maxflow::pushrelabel::PushRelabel
source · pub struct PushRelabel<'a, G, F>where
G: 'a + IndexDigraph,{
pub cnt_relabel: usize,
pub use_global_relabelling: bool,
/* private fields */
}
Expand description
The push-relabel algorithm.
This struct contains all algorithmic working data.
Fields§
§cnt_relabel: usize
The number of relabel operations performed during the algorithm.
use_global_relabelling: bool
Whether to use the global relabelling heuristic.
Implementations§
source§impl<'a, G, F> PushRelabel<'a, G, F>where
G: IndexDigraph,
F: NumAssign + Ord + Copy,
impl<'a, G, F> PushRelabel<'a, G, F>where G: IndexDigraph, F: NumAssign + Ord + Copy,
sourcepub fn new(g: &'a G) -> Self
pub fn new(g: &'a G) -> Self
Return a new push-relabel algorithm data structure for the digraph g
.
sourcepub fn value(&self) -> F
pub fn value(&self) -> F
Return the flow value.
The function returns 0 if the flow has not been computed, yet.
sourcepub fn flow(&self, e: G::Edge<'_>) -> F
pub fn flow(&self, e: G::Edge<'_>) -> F
Return the flow value over some edge.
The function returns 0 if the flow has not been computed, yet.
sourcepub fn flow_iter<'b>(&'b self) -> impl Iterator<Item = (G::Edge<'a>, F)> + 'b
pub fn flow_iter<'b>(&'b self) -> impl Iterator<Item = (G::Edge<'a>, F)> + 'b
Return an iterator over all (edge, flow) pairs.
sourcepub fn solve<Us>(&mut self, src: G::Node<'_>, snk: G::Node<'_>, upper: Us)where
Us: Fn(G::Edge<'a>) -> F,
pub fn solve<Us>(&mut self, src: G::Node<'_>, snk: G::Node<'_>, upper: Us)where Us: Fn(G::Edge<'a>) -> F,
Run the push-relabel algorithm from some source to some sink node.
The method solved the max flow problem from the source node
src
to the sink node snk
with the given upper
bounds on
the edges.
Auto Trait Implementations§
impl<'a, G, F> RefUnwindSafe for PushRelabel<'a, G, F>where F: RefUnwindSafe, G: RefUnwindSafe,
impl<'a, G, F> Send for PushRelabel<'a, G, F>where F: Send, G: Sync,
impl<'a, G, F> Sync for PushRelabel<'a, G, F>where F: Sync, G: Sync,
impl<'a, G, F> Unpin for PushRelabel<'a, G, F>where F: Unpin,
impl<'a, G, F> UnwindSafe for PushRelabel<'a, G, F>where F: UnwindSafe, G: RefUnwindSafe,
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