pub struct SimpleGraph { /* private fields */ }Expand description
Simple directed graph.
Implementations§
Source§impl SimpleGraph
impl SimpleGraph
pub fn new() -> Self
pub fn add_node(&mut self, id: u32, label: &str)
pub fn remove_node(&mut self, id: u32) -> bool
pub fn add_edge(&mut self, from: u32, to: u32, label: &str, weight: f32)
pub fn node_count(&self) -> usize
pub fn edge_count(&self) -> usize
pub fn has_node(&self, id: u32) -> bool
pub fn neighbors(&self, id: u32) -> Vec<u32>
pub fn in_neighbors(&self, id: u32) -> Vec<u32>
Sourcepub fn has_path(&self, from: u32, to: u32) -> bool
pub fn has_path(&self, from: u32, to: u32) -> bool
Check whether there is a path from from to to.
pub fn node_label(&self, id: u32) -> Option<&str>
pub fn is_empty(&self) -> bool
pub fn clear(&mut self)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SimpleGraph
impl RefUnwindSafe for SimpleGraph
impl Send for SimpleGraph
impl Sync for SimpleGraph
impl Unpin for SimpleGraph
impl UnsafeUnpin for SimpleGraph
impl UnwindSafe for SimpleGraph
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