Skip to main content

Graph

Struct Graph 

Source
pub struct Graph<N, E, G>
where N: Default + 'static, E: Default + 'static, G: Default,
{ /* private fields */ }

Implementations§

Source§

impl<N, E, G> Graph<N, E, G>
where N: Default + 'static, E: Default + 'static, G: Default,

Source

pub fn compact_if_sparse(&mut self, max_capacity_factor: f64) -> bool

Source

pub fn new(options: GraphOptions) -> Self

Source

pub fn with_capacity( options: GraphOptions, node_capacity: usize, edge_capacity: usize, ) -> Self

Source

pub fn options(&self) -> GraphOptions

Source

pub fn is_multigraph(&self) -> bool

Source

pub fn is_compound(&self) -> bool

Source

pub fn is_directed(&self) -> bool

Source

pub fn set_graph(&mut self, label: G) -> &mut Self

Source

pub fn graph(&self) -> &G

Source

pub fn graph_mut(&mut self) -> &mut G

Source

pub fn set_default_node_label<F>(&mut self, f: F) -> &mut Self
where F: Fn() -> N + Send + Sync + 'static,

Source

pub fn set_default_edge_label<F>(&mut self, f: F) -> &mut Self
where F: Fn() -> E + Send + Sync + 'static,

Source

pub fn has_node(&self, id: &str) -> bool

Source

pub fn node_ix(&self, id: &str) -> Option<usize>

Source

pub fn node_id_by_ix(&self, ix: usize) -> Option<&str>

Source

pub fn node_label_by_ix(&self, ix: usize) -> Option<&N>

Source

pub fn node_label_mut_by_ix(&mut self, ix: usize) -> Option<&mut N>

Source

pub fn has_edge_ix(&self, v_ix: usize, w_ix: usize) -> bool

Source

pub fn edge_by_endpoints_ix(&self, v_ix: usize, w_ix: usize) -> Option<&E>

Source

pub fn set_node(&mut self, id: impl Into<String>, label: N) -> &mut Self

Source

pub fn ensure_node(&mut self, id: impl Into<String>) -> &mut Self

Source

pub fn ensure_node_ref(&mut self, id: &str) -> &mut Self

Source

pub fn node(&self, id: &str) -> Option<&N>

Source

pub fn node_mut(&mut self, id: &str) -> Option<&mut N>

Source

pub fn node_count(&self) -> usize

Source

pub fn nodes(&self) -> impl Iterator<Item = &str>

Source

pub fn node_ids(&self) -> Vec<String>

Source

pub fn edge_count(&self) -> usize

Source

pub fn edge_key_by_ix(&self, edge_ix: usize) -> Option<&EdgeKey>

Source

pub fn edges(&self) -> impl Iterator<Item = &EdgeKey>

Source

pub fn for_each_edge<F>(&self, f: F)
where F: FnMut(&EdgeKey, &E),

Source

pub fn for_each_edge_ix<F>(&self, f: F)
where F: FnMut(usize, usize, &EdgeKey, &E),

Source

pub fn for_each_edge_entry_ix<F>(&self, f: F)
where F: FnMut(usize, usize, usize, &EdgeKey, &E),

Source

pub fn for_each_edge_mut<F>(&mut self, f: F)
where F: FnMut(&EdgeKey, &mut E),

Source

pub fn for_each_node<F>(&self, f: F)
where F: FnMut(&str, &N),

Source

pub fn for_each_node_ix<F>(&self, f: F)
where F: FnMut(usize, &str, &N),

Source

pub fn for_each_node_mut<F>(&mut self, f: F)
where F: FnMut(&str, &mut N),

Source

pub fn edge_keys(&self) -> Vec<EdgeKey>

Source

pub fn set_edge( &mut self, v: impl Into<String>, w: impl Into<String>, ) -> &mut Self

Source

pub fn set_edge_with_label( &mut self, v: impl Into<String>, w: impl Into<String>, label: E, ) -> &mut Self

Source

pub fn set_edge_named( &mut self, v: impl Into<String>, w: impl Into<String>, name: Option<impl Into<String>>, label: Option<E>, ) -> &mut Self

Source

pub fn set_path(&mut self, nodes: &[&str]) -> &mut Self

Source

pub fn has_edge(&self, v: &str, w: &str, name: Option<&str>) -> bool

Source

pub fn edge(&self, v: &str, w: &str, name: Option<&str>) -> Option<&E>

Source

pub fn edge_mut( &mut self, v: &str, w: &str, name: Option<&str>, ) -> Option<&mut E>

Source

pub fn edge_by_key(&self, key: &EdgeKey) -> Option<&E>

Source

pub fn edge_mut_by_key(&mut self, key: &EdgeKey) -> Option<&mut E>

Source

pub fn remove_edge_key(&mut self, key: &EdgeKey) -> bool

Source

pub fn remove_edge(&mut self, v: &str, w: &str, name: Option<&str>) -> bool

Source

pub fn remove_node(&mut self, id: &str) -> bool

Source

pub fn successors(&self, v: &str) -> Vec<&str>

Source

pub fn predecessors(&self, v: &str) -> Vec<&str>

Source

pub fn first_successor<'a>(&'a self, v: &str) -> Option<&'a str>

Source

pub fn first_predecessor<'a>(&'a self, v: &str) -> Option<&'a str>

Source

pub fn extend_successors<'a>(&'a self, v: &str, out: &mut Vec<&'a str>)

Source

pub fn extend_predecessors<'a>(&'a self, v: &str, out: &mut Vec<&'a str>)

Source

pub fn for_each_successor<'a, F>(&'a self, v: &str, f: F)
where F: FnMut(&'a str),

Source

pub fn for_each_predecessor<'a, F>(&'a self, v: &str, f: F)
where F: FnMut(&'a str),

Source

pub fn neighbors(&self, v: &str) -> Vec<&str>

Source

pub fn out_edges(&self, v: &str, w: Option<&str>) -> Vec<EdgeKey>

Source

pub fn in_edges(&self, v: &str, w: Option<&str>) -> Vec<EdgeKey>

Source

pub fn for_each_out_edge<F>(&self, v: &str, w: Option<&str>, f: F)
where F: FnMut(&EdgeKey, &E),

Source

pub fn for_each_in_edge<F>(&self, v: &str, w: Option<&str>, f: F)
where F: FnMut(&EdgeKey, &E),

Source

pub fn set_edge_key(&mut self, key: EdgeKey, label: E) -> &mut Self

Source

pub fn for_each_out_edge_ix<F>(&self, v_ix: usize, w_ix: Option<usize>, f: F)
where F: FnMut(usize, usize, &EdgeKey, &E),

Source

pub fn for_each_out_edge_entry_ix<F>( &self, v_ix: usize, w_ix: Option<usize>, f: F, )
where F: FnMut(usize, usize, usize, &EdgeKey, &E),

Source

pub fn for_each_neighbor_ix<F>(&self, v_ix: usize, f: F)
where F: FnMut(usize),

Source

pub fn for_each_in_edge_ix<F>(&self, v_ix: usize, w_ix: Option<usize>, f: F)
where F: FnMut(usize, usize, &EdgeKey, &E),

Source

pub fn for_each_in_edge_entry_ix<F>( &self, v_ix: usize, w_ix: Option<usize>, f: F, )
where F: FnMut(usize, usize, usize, &EdgeKey, &E),

Source

pub fn set_parent( &mut self, child: impl Into<String>, parent: impl Into<String>, ) -> &mut Self

Source

pub fn set_parent_ref(&mut self, child: &str, parent: &str) -> &mut Self

Source

pub fn set_parent_ix(&mut self, child_ix: usize, parent_ix: usize) -> &mut Self

Source

pub fn clear_parent(&mut self, child: &str) -> &mut Self

Source

pub fn parent(&self, child: &str) -> Option<&str>

Source

pub fn children_iter<'a>( &'a self, parent: &str, ) -> impl Iterator<Item = &'a str> + 'a

Source

pub fn children(&self, parent: &str) -> Vec<&str>

Source

pub fn children_root(&self) -> Vec<&str>

Source

pub fn sources(&self) -> Vec<&str>

Source

pub fn node_edges(&self, v: &str) -> Vec<EdgeKey>

Auto Trait Implementations§

§

impl<N, E, G> !Freeze for Graph<N, E, G>

§

impl<N, E, G> !RefUnwindSafe for Graph<N, E, G>

§

impl<N, E, G> Send for Graph<N, E, G>
where G: Send, N: Send, E: Send,

§

impl<N, E, G> !Sync for Graph<N, E, G>

§

impl<N, E, G> Unpin for Graph<N, E, G>
where G: Unpin, N: Unpin, E: Unpin,

§

impl<N, E, G> UnsafeUnpin for Graph<N, E, G>
where G: UnsafeUnpin,

§

impl<N, E, G> !UnwindSafe for Graph<N, E, G>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.