[−][src]Struct toposort_scc::ArenaGraph
An adjacency-list-based graph data structure wrapping an Arena
from the
id-arena
crate.
Stores graph vertices as lists of incoming and outgoing edges by their
Id
in the graph.
Implementations
impl<'a, T, A: ArenaBehavior> ArenaGraph<'a, T, A>
[src]
pub fn from_graph<F>(g: &'a Arena<T, A>, f: F) -> ArenaGraph<'a, T, A> where
F: FnMut(ArenaGraphBuilder<'_, 'a, T, A>, &T),
[src]
F: FnMut(ArenaGraphBuilder<'_, 'a, T, A>, &T),
Create a new graph from an existing Arena
-based graph-like data
structure
The given closure will be called once for every element of g
, with an
ArenaGraphBuilder
instance so that edges can be easily added.
pub fn arena_id(&self) -> u32
[src]
Returns the id of the arena this graph belongs to
pub fn as_index_graph(&self) -> &IndexGraph
[src]
Returns a reference to the underlying IndexGraph
pub fn into_index_graph(self) -> IndexGraph
[src]
Returns the underlying IndexGraph
pub fn toposort_or_scc(self) -> Result<Vec<A::Id>, Vec<Vec<A::Id>>>
[src]
Perform topological sort or find strongly connected components
If the graph contains no cycles, finds the topological ordering of this
graph using Kahn's algorithm and returns it as Ok(sorted)
.
If the graph contains cycles, finds the strongly connected components of
this graph using Kosaraju's algorithm and returns them as Err(cycles)
.
Trait Implementations
impl<'a, T: Clone, A: Clone + ArenaBehavior> Clone for ArenaGraph<'a, T, A>
[src]
fn clone(&self) -> ArenaGraph<'a, T, A>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'a, T: Debug, A: Debug + ArenaBehavior> Debug for ArenaGraph<'a, T, A>
[src]
impl<'_, T, A: ArenaBehavior> Index<<A as ArenaBehavior>::Id> for ArenaGraph<'_, T, A>
[src]
Auto Trait Implementations
impl<'a, T, A> RefUnwindSafe for ArenaGraph<'a, T, A> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, T, A> Send for ArenaGraph<'a, T, A> where
T: Sync,
T: Sync,
impl<'a, T, A> Sync for ArenaGraph<'a, T, A> where
T: Sync,
T: Sync,
impl<'a, T, A> Unpin for ArenaGraph<'a, T, A>
impl<'a, T, A> UnwindSafe for ArenaGraph<'a, T, A> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,