[][src]Struct ojo_graph::partition::Partition

pub struct Partition<G: Graph + ?Sized> { /* fields omitted */ }

A partition of a the nodes of a graph.

Tarjan's algorithm decomposes a directed graph into strongly connected components. Moreover, those components are ordered topologically.

Methods

impl<G: Graph + ?Sized> Partition<G>[src]

pub fn num_components(&self) -> usize[src]

pub fn parts<'b>(&'b self) -> impl Iterator<Item = &'b HashSet<G::Node>>[src]

pub fn part(&self, i: usize) -> &HashSet<G::Node>[src]

pub fn index_of(&self, u: &G::Node) -> usize[src]

pub fn into_parts(self) -> Vec<HashSet<G::Node>>[src]

Trait Implementations

impl<G: Graph + ?Sized> Graph for Partition<G>[src]

type Node = usize

type Edge = usize

fn out_neighbors<'a>(
    &'a self,
    u: &Self::Node
) -> Map<Box<dyn Iterator<Item = Self::Edge> + 'a>, fn(_: Self::Edge) -> Self::Node>
[src]

fn in_neighbors<'a>(
    &'a self,
    u: &Self::Node
) -> Map<Box<dyn Iterator<Item = Self::Edge> + 'a>, fn(_: Self::Edge) -> Self::Node>
[src]

Important traits for Dfs<'a, G>
fn dfs<'a>(&'a self) -> Dfs<'a, Self>[src]

Important traits for Dfs<'a, G>
fn dfs_from<'a>(&'a self, root: &Self::Node) -> Dfs<'a, Self>[src]

fn has_path(&self, u: &Self::Node, v: &Self::Node) -> bool[src]

fn tarjan(&self) -> Partition<Self>[src]

fn weak_components(&self) -> Partition<Self>[src]

fn doubled<'a>(&'a self) -> Doubled<'a, Self>[src]

Returns the graph that has edges in both directions for every edge that this graph has in one direction. Read more

fn node_filtered<'a, F>(&'a self, predicate: F) -> NodeFiltered<'a, Self, F> where
    F: Fn(&Self::Node) -> bool
[src]

Returns the subgraph of this graph that is induced by the set of nodes for which predicate returns true. Read more

fn edge_filtered<'a, F>(&'a self, predicate: F) -> EdgeFiltered<'a, Self, F> where
    F: Fn(&Self::Node, &Self::Edge) -> bool
[src]

Returns the subgraph of this graph containing all the edges for which the predicate returns true. Read more

fn top_sort<'a>(&'a self) -> Option<Vec<Self::Node>>[src]

If this graph is acyclic, returns a topological sort of the vertices. Otherwise, returns None. Read more

fn linear_order<'a>(&'a self) -> Option<Vec<Self::Node>>[src]

fn neighbor_set<'a, I: Iterator<Item = &'a Self::Node>>(
    &self,
    set: I
) -> HashSet<Self::Node> where
    Self::Node: 'a, 
[src]

Returns the set of all nodes that are adjacent (either an in-neighbor or an out-neighbor) to something in set. Read more

Auto Trait Implementations

impl<G: ?Sized> Send for Partition<G> where
    <G as Graph>::Node: Send

impl<G: ?Sized> Sync for Partition<G> where
    <G as Graph>::Node: Sync

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.