pub struct UndirectedGraph<V> { /* private fields */ }
Expand description
An undirected graph with a value on each edge.
Implementations§
Source§impl<V: Copy> UndirectedGraph<V>
impl<V: Copy> UndirectedGraph<V>
pub fn new(vertex_count: usize) -> Self
pub fn has_edges(&self, vertex: usize) -> bool
Sourcepub fn add_edge(&mut self, vertex_a: usize, vertex_b: usize, value: V) -> bool
pub fn add_edge(&mut self, vertex_a: usize, vertex_b: usize, value: V) -> bool
Adds an edge between vertex_a
and vertex_b
with the specified value
.
Returns true
if successful, and false
if an edge already existed with a different value.
pub fn pop_edge(&mut self, vertex: usize) -> Option<Edge<V>>
Sourcepub fn pop_only_edge(&mut self, vertex: usize) -> Option<Edge<V>>
pub fn pop_only_edge(&mut self, vertex: usize) -> Option<Edge<V>>
Returns the edge if it is the only one remaining. A self-reference does not count, so the function returns None
.
Trait Implementations§
Source§impl<V: Debug> Debug for UndirectedGraph<V>
impl<V: Debug> Debug for UndirectedGraph<V>
Source§impl<V: PartialEq> PartialEq for UndirectedGraph<V>
impl<V: PartialEq> PartialEq for UndirectedGraph<V>
impl<V> StructuralPartialEq for UndirectedGraph<V>
Auto Trait Implementations§
impl<V> Freeze for UndirectedGraph<V>
impl<V> RefUnwindSafe for UndirectedGraph<V>where
V: RefUnwindSafe,
impl<V> Send for UndirectedGraph<V>where
V: Send,
impl<V> Sync for UndirectedGraph<V>where
V: Sync,
impl<V> Unpin for UndirectedGraph<V>where
V: Unpin,
impl<V> UnwindSafe for UndirectedGraph<V>where
V: UnwindSafe,
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