pub struct Graph {
pub nodes: HashMap<String, GraphNode>,
pub edges: Vec<GraphEdge>,
pub directed: bool,
}Expand description
Graph representation
Fields§
§nodes: HashMap<String, GraphNode>§edges: Vec<GraphEdge>§directed: boolImplementations§
Source§impl Graph
impl Graph
pub fn new(directed: bool) -> Self
pub fn add_node(&mut self, node: GraphNode)
pub fn add_edge(&mut self, edge: GraphEdge)
pub fn get_neighbors(&self, node_id: &str) -> Vec<&str>
pub fn get_degree(&self, node_id: &str) -> usize
pub fn is_connected(&self) -> bool
pub fn find_cycles(&self) -> Vec<Vec<String>>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Graph
impl RefUnwindSafe for Graph
impl Send for Graph
impl Sync for Graph
impl Unpin for Graph
impl UnwindSafe for Graph
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