[−][src]Struct libquilt::ChainGraggle
A version of a Graggle
that has been decomposed into "chains" (for example, for
prettier rendering).
Most graggles that you'll see in practice don't look like general directed graphs. Rather, they contain lots of long "chains," i.e., sequences of nodes, each of which has exactly one in-neighbor (the previous in the sequence) and one out-neighbor (the next). For example, a totally ordered graggle (a.k.a. a file) just consists of one long chain.
This struct represents the same graph as a graggle, except that every chain has been "collapsed"
into a single node. That is, you can think of a ChainGraggle
as a graph in which every node
represents a chain (possibly of length 1) in the original graph.
Methods
impl ChainGraggle
[src]
pub fn num_chains(&self) -> usize
[src]
How many chains are there?
pub fn chain(&self, i: usize) -> &[NodeId]
[src]
Returns the sequence of NodeId
s making up the chain at index i
.
pub fn clusters(
&self
) -> impl Iterator<Item = &HashSet<usize>>
[src]
&self
) -> impl Iterator<Item = &HashSet<usize>>
Returns an iterator over strongly connected components of the original graph.
pub fn from_graph<G: Graph<Node = NodeId>>(g: G) -> ChainGraggle where
G::Edge: Edge<NodeId>,
[src]
G::Edge: Edge<NodeId>,
Given a graph, decompose it into a ChainGraggle
.
Trait Implementations
impl Clone for ChainGraggle
[src]
fn clone(&self) -> ChainGraggle
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for ChainGraggle
[src]
impl Graph for ChainGraggle
[src]
In this implementation of [graph::Graph
], the nodes are (semantically) chains in the original
graggle. More precisely, they are usize
s that you can use to get the chain with
ChainGraggle::chain
.
type Node = usize
type Edge = usize
fn nodes(&self) -> Box<dyn Iterator<Item = usize>>
[src]
fn out_edges(&self, u: &usize) -> Box<dyn Iterator<Item = usize>>
[src]
fn in_edges(&self, _u: &usize) -> Box<dyn Iterator<Item = usize>>
[src]
fn out_neighbors(
&'a self,
u: &Self::Node
) -> Map<Box<dyn Iterator<Item = Self::Edge> + 'a>, fn(Self::Edge) -> Self::Node>
[src]
&'a self,
u: &Self::Node
) -> Map<Box<dyn Iterator<Item = Self::Edge> + 'a>, fn(Self::Edge) -> Self::Node>
fn in_neighbors(
&'a self,
u: &Self::Node
) -> Map<Box<dyn Iterator<Item = Self::Edge> + 'a>, fn(Self::Edge) -> Self::Node>
[src]
&'a self,
u: &Self::Node
) -> Map<Box<dyn Iterator<Item = Self::Edge> + 'a>, fn(Self::Edge) -> Self::Node>
fn dfs(&'a self) -> Dfs<'a, Self>
[src]
fn dfs_from(&'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 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<F>(&'a self, predicate: F) -> NodeFiltered<'a, Self, F> where
F: Fn(&Self::Node) -> bool,
[src]
F: Fn(&Self::Node) -> bool,
Returns the subgraph of this graph that is induced by the set of nodes for which predicate
returns true
. Read more
fn edge_filtered<F>(&'a self, predicate: F) -> EdgeFiltered<'a, Self, F> where
F: Fn(&Self::Node, &Self::Edge) -> bool,
[src]
F: Fn(&Self::Node, &Self::Edge) -> bool,
Returns the subgraph of this graph containing all the edges for which the predicate returns true. Read more
fn top_sort(&'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 self) -> Option<Vec<Self::Node>>
[src]
fn neighbor_set<'a, I>(&self, set: I) -> HashSet<Self::Node, RandomState> where
I: Iterator<Item = &'a Self::Node>,
Self::Node: 'a,
[src]
I: Iterator<Item = &'a Self::Node>,
Self::Node: 'a,
Returns the set of all nodes that are adjacent (either an in-neighbor or an out-neighbor) to something in set
. Read more
impl<'de> Deserialize<'de> for ChainGraggle
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Serialize for ChainGraggle
[src]
Auto Trait Implementations
impl Send for ChainGraggle
impl Sync for ChainGraggle
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> Same for T
type Output = T
Should always be Self