pub struct DagAnalysis<N: GraphNodeId, S: BuildHasher = FixedHasher> { /* private fields */ }Expand description
Stores the results of a call to Dag::analyze.
Implementations§
Source§impl<N: GraphNodeId, S: BuildHasher> DagAnalysis<N, S>
impl<N: GraphNodeId, S: BuildHasher> DagAnalysis<N, S>
Sourcepub fn new(graph: &DiGraph<N, S>, topological_order: &[N]) -> Selfwhere
S: Default,
pub fn new(graph: &DiGraph<N, S>, topological_order: &[N]) -> Selfwhere
S: Default,
Processes a DAG and computes its:
- transitive reduction (along with the set of removed edges)
- transitive closure
- reachability matrix (as a bitset)
- pairs of nodes connected by a path
- pairs of nodes not connected by a path
The algorithm implemented comes from “On the calculation of transitive reduction-closure of orders” by Habib, Morvan and Rampon.
Sourcepub fn reachable(&self) -> &FixedBitSet
pub fn reachable(&self) -> &FixedBitSet
Returns the reachability matrix.
Sourcepub fn connected(&self) -> &HashSet<(N, N), S>
pub fn connected(&self) -> &HashSet<(N, N), S>
Returns the set of node pairs that are connected by a path.
Sourcepub fn disconnected(&self) -> &[(N, N)]
pub fn disconnected(&self) -> &[(N, N)]
Returns the list of node pairs that are not connected by a path.
Sourcepub fn transitive_edges(&self) -> &[(N, N)]
pub fn transitive_edges(&self) -> &[(N, N)]
Returns the list of redundant edges because a longer path exists.
Sourcepub fn transitive_reduction(&self) -> &DiGraph<N, S>
pub fn transitive_reduction(&self) -> &DiGraph<N, S>
Returns the transitive reduction of the graph.
Sourcepub fn transitive_closure(&self) -> &DiGraph<N, S>
pub fn transitive_closure(&self) -> &DiGraph<N, S>
Returns the transitive closure of the graph.
Sourcepub fn check_for_redundant_edges(&self) -> Result<(), DagRedundancyError<N>>where
S: Clone,
pub fn check_for_redundant_edges(&self) -> Result<(), DagRedundancyError<N>>where
S: Clone,
Checks if the graph has any redundant (transitive) edges.
§Errors
If there are redundant edges, returns a DagRedundancyError
containing the list of redundant edges.
Sourcepub fn check_for_cross_dependencies(
&self,
other: &Self,
) -> Result<(), DagCrossDependencyError<N>>
pub fn check_for_cross_dependencies( &self, other: &Self, ) -> Result<(), DagCrossDependencyError<N>>
Checks if there are any pairs of nodes that have a path in both this graph and another graph.
§Errors
Returns DagCrossDependencyError if any node pair is connected in
both graphs.
Sourcepub fn check_for_overlapping_groups<K, V>(
&self,
groups: &DagGroups<K, V>,
) -> Result<(), DagOverlappingGroupError<K>>
pub fn check_for_overlapping_groups<K, V>( &self, groups: &DagGroups<K, V>, ) -> Result<(), DagOverlappingGroupError<K>>
Checks if any connected node pairs that are both keys have overlapping groups.
§Errors
If there are overlapping groups, returns a DagOverlappingGroupError
containing the first pair of keys that have overlapping groups.
Trait Implementations§
Source§impl<N: GraphNodeId, S: BuildHasher> Debug for DagAnalysis<N, S>
impl<N: GraphNodeId, S: BuildHasher> Debug for DagAnalysis<N, S>
Source§impl<N: GraphNodeId, S: BuildHasher + Default> Default for DagAnalysis<N, S>
impl<N: GraphNodeId, S: BuildHasher + Default> Default for DagAnalysis<N, S>
Auto Trait Implementations§
impl<N, S> Freeze for DagAnalysis<N, S>where
S: Freeze,
impl<N, S> RefUnwindSafe for DagAnalysis<N, S>where
S: RefUnwindSafe,
N: RefUnwindSafe,
<N as GraphNodeId>::Edge: RefUnwindSafe,
<N as GraphNodeId>::Adjacent: RefUnwindSafe,
impl<N, S> Send for DagAnalysis<N, S>
impl<N, S> Sync for DagAnalysis<N, S>
impl<N, S> Unpin for DagAnalysis<N, S>
impl<N, S> UnwindSafe for DagAnalysis<N, S>where
S: UnwindSafe,
N: UnwindSafe,
<N as GraphNodeId>::Edge: UnwindSafe,
<N as GraphNodeId>::Adjacent: UnwindSafe,
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().