pub struct UndirectedGraph { /* private fields */ }Expand description
无向图
Implementations§
Source§impl UndirectedGraph
impl UndirectedGraph
pub fn new() -> Self
pub fn add_node(&mut self, node: NodeId)
pub fn add_edge(&mut self, from: NodeId, to: NodeId, weight: Weight)
pub fn add_edge_unweighted(&mut self, from: NodeId, to: NodeId)
pub fn node_count(&self) -> usize
pub fn edge_count(&self) -> usize
pub fn bfs(&self, start: NodeId) -> Vec<NodeId> ⓘ
pub fn dfs(&self, start: NodeId) -> Vec<NodeId> ⓘ
pub fn connected_components(&self) -> Vec<Vec<NodeId>>
pub fn has_node(&self, node: NodeId) -> bool
pub fn has_edge(&self, from: NodeId, to: NodeId) -> bool
pub fn degree(&self, node: NodeId) -> usize
Trait Implementations§
Source§impl Clone for UndirectedGraph
impl Clone for UndirectedGraph
Source§fn clone(&self) -> UndirectedGraph
fn clone(&self) -> UndirectedGraph
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for UndirectedGraph
impl Debug for UndirectedGraph
Source§impl Default for UndirectedGraph
impl Default for UndirectedGraph
Source§fn default() -> UndirectedGraph
fn default() -> UndirectedGraph
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for UndirectedGraph
impl RefUnwindSafe for UndirectedGraph
impl Send for UndirectedGraph
impl Sync for UndirectedGraph
impl Unpin for UndirectedGraph
impl UnsafeUnpin for UndirectedGraph
impl UnwindSafe for UndirectedGraph
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