pub struct ApproxMinCut { /* private fields */ }Expand description
Approximate minimum cut for all cut sizes
Achieves (1+ε)-approximation for any cut size using spectral sparsification.
§Example
ⓘ
use ruvector_mincut::algorithm::approximate::ApproxMinCut;
let mut approx = ApproxMinCut::new(ApproxMinCutConfig::default());
approx.insert_edge(0, 1, 1.0);
approx.insert_edge(1, 2, 1.0);
approx.insert_edge(2, 0, 1.0);
let result = approx.min_cut();
assert!(result.value >= 2.0 * 0.9); // (1-ε) lower boundImplementations§
Source§impl ApproxMinCut
impl ApproxMinCut
Sourcepub fn new(config: ApproxMinCutConfig) -> Self
pub fn new(config: ApproxMinCutConfig) -> Self
Create new approximate min-cut structure
Sourcepub fn with_epsilon(epsilon: f64) -> Self
pub fn with_epsilon(epsilon: f64) -> Self
Create with default configuration
Sourcepub fn insert_edge(&mut self, u: VertexId, v: VertexId, weight: f64)
pub fn insert_edge(&mut self, u: VertexId, v: VertexId, weight: f64)
Insert an edge
Sourcepub fn delete_edge(&mut self, u: VertexId, v: VertexId)
pub fn delete_edge(&mut self, u: VertexId, v: VertexId)
Delete an edge
Sourcepub fn min_cut(&mut self) -> ApproxMinCutResult
pub fn min_cut(&mut self) -> ApproxMinCutResult
Query approximate minimum cut
Sourcepub fn min_cut_value(&mut self) -> f64
pub fn min_cut_value(&mut self) -> f64
Get minimum cut value only
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Check if graph is connected
Sourcepub fn vertex_count(&self) -> usize
pub fn vertex_count(&self) -> usize
Get vertex count
Sourcepub fn edge_count(&self) -> usize
pub fn edge_count(&self) -> usize
Get edge count
Sourcepub fn stats(&self) -> &ApproxMinCutStats
pub fn stats(&self) -> &ApproxMinCutStats
Get statistics
Trait Implementations§
Source§impl Debug for ApproxMinCut
impl Debug for ApproxMinCut
Auto Trait Implementations§
impl Freeze for ApproxMinCut
impl RefUnwindSafe for ApproxMinCut
impl Send for ApproxMinCut
impl Sync for ApproxMinCut
impl Unpin for ApproxMinCut
impl UnwindSafe for ApproxMinCut
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> 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