pub struct PolylogConnectivity { /* private fields */ }Expand description
Polylogarithmic worst-case dynamic connectivity
Maintains connectivity with O(log³ n) expected worst-case update time.
§Example
ⓘ
use ruvector_mincut::connectivity::polylog::PolylogConnectivity;
let mut conn = PolylogConnectivity::new();
conn.insert_edge(0, 1);
conn.insert_edge(1, 2);
assert!(conn.connected(0, 2));
conn.delete_edge(1, 2);
assert!(!conn.connected(0, 2));Implementations§
Source§impl PolylogConnectivity
impl PolylogConnectivity
Sourcepub fn insert_edge(&mut self, u: VertexId, v: VertexId)
pub fn insert_edge(&mut self, u: VertexId, v: VertexId)
Insert an edge
Time complexity: O(log³ n) expected worst-case
Sourcepub fn delete_edge(&mut self, u: VertexId, v: VertexId)
pub fn delete_edge(&mut self, u: VertexId, v: VertexId)
Delete an edge
Time complexity: O(log³ n) expected worst-case
Sourcepub fn connected(&mut self, u: VertexId, v: VertexId) -> bool
pub fn connected(&mut self, u: VertexId, v: VertexId) -> bool
Check if two vertices are connected
Time complexity: O(log n) worst-case
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Check if the entire graph is connected
Sourcepub fn component_count(&self) -> usize
pub fn component_count(&self) -> usize
Get number of connected components
Sourcepub fn vertex_count(&self) -> usize
pub fn vertex_count(&self) -> usize
Get number of vertices
Sourcepub fn edge_count(&self) -> usize
pub fn edge_count(&self) -> usize
Get number of edges
Sourcepub fn stats(&self) -> &PolylogStats
pub fn stats(&self) -> &PolylogStats
Get statistics
Trait Implementations§
Source§impl Debug for PolylogConnectivity
impl Debug for PolylogConnectivity
Auto Trait Implementations§
impl Freeze for PolylogConnectivity
impl RefUnwindSafe for PolylogConnectivity
impl Send for PolylogConnectivity
impl Sync for PolylogConnectivity
impl Unpin for PolylogConnectivity
impl UnwindSafe for PolylogConnectivity
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