pub struct DynamicGraph { /* private fields */ }Expand description
Dynamic graph structure for minimum cut algorithm
Implementations§
Source§impl DynamicGraph
impl DynamicGraph
Sourcepub fn with_capacity(vertices: usize, edges: usize) -> Self
pub fn with_capacity(vertices: usize, edges: usize) -> Self
Create with capacity hint
Sourcepub fn add_vertex(&self, v: VertexId) -> bool
pub fn add_vertex(&self, v: VertexId) -> bool
Add a vertex (returns true if new)
Sourcepub fn has_vertex(&self, v: VertexId) -> bool
pub fn has_vertex(&self, v: VertexId) -> bool
Check if vertex exists
Sourcepub fn insert_edge(
&self,
u: VertexId,
v: VertexId,
weight: Weight,
) -> Result<EdgeId>
pub fn insert_edge( &self, u: VertexId, v: VertexId, weight: Weight, ) -> Result<EdgeId>
Insert an edge (returns edge ID if successful)
Sourcepub fn delete_edge(&self, u: VertexId, v: VertexId) -> Result<Edge>
pub fn delete_edge(&self, u: VertexId, v: VertexId) -> Result<Edge>
Delete an edge (returns the removed edge)
Sourcepub fn num_vertices(&self) -> usize
pub fn num_vertices(&self) -> usize
Get number of vertices
Sourcepub fn stats(&self) -> GraphStats
pub fn stats(&self) -> GraphStats
Get graph statistics
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Check if graph is connected using BFS
Sourcepub fn connected_components(&self) -> Vec<Vec<VertexId>>
pub fn connected_components(&self) -> Vec<Vec<VertexId>>
Get connected components using BFS
Sourcepub fn remove_vertex(&self, v: VertexId) -> Result<()>
pub fn remove_vertex(&self, v: VertexId) -> Result<()>
Remove a vertex and all its incident edges
Trait Implementations§
Source§impl Clone for DynamicGraph
impl Clone for DynamicGraph
Auto Trait Implementations§
impl !Freeze for DynamicGraph
impl !RefUnwindSafe for DynamicGraph
impl Send for DynamicGraph
impl Sync for DynamicGraph
impl Unpin for DynamicGraph
impl UnwindSafe for DynamicGraph
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