pub struct DirectedGraph { /* private fields */ }Expand description
A directed graph.
Implementations§
Source§impl DirectedGraph
impl DirectedGraph
pub fn new() -> Self
pub fn with_n_nodes(n: usize) -> Self
pub fn add_node(&mut self, node: usize)
pub fn add_edge(&mut self, from: usize, to: usize)
pub fn node_count(&self) -> usize
pub fn edge_count(&self) -> usize
pub fn out_degree(&self, node: usize) -> usize
pub fn in_degree(&self, node: usize) -> usize
pub fn successors(&self, node: usize) -> Vec<usize>
pub fn predecessors(&self, node: usize) -> Vec<usize>
pub fn nodes(&self) -> Vec<usize>
pub fn has_edge(&self, from: usize, to: usize) -> bool
pub fn out_edges_map(&self) -> &HashMap<usize, HashSet<usize>>
Sourcepub fn to_undirected(&self) -> Graph
pub fn to_undirected(&self) -> Graph
Convert to undirected Graph.
Trait Implementations§
Source§impl Clone for DirectedGraph
impl Clone for DirectedGraph
Source§fn clone(&self) -> DirectedGraph
fn clone(&self) -> DirectedGraph
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 DirectedGraph
impl Debug for DirectedGraph
Source§impl<'de> Deserialize<'de> for DirectedGraph
impl<'de> Deserialize<'de> for DirectedGraph
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for DirectedGraph
impl RefUnwindSafe for DirectedGraph
impl Send for DirectedGraph
impl Sync for DirectedGraph
impl Unpin for DirectedGraph
impl UnsafeUnpin for DirectedGraph
impl UnwindSafe for DirectedGraph
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