Trait DirectedGraph

Source
pub trait DirectedGraph {
    type Node: Idx;

    // Required method
    fn num_nodes(&self) -> usize;

    // Provided method
    fn iter_nodes(
        &self,
    ) -> impl Iterator<Item = Self::Node> + DoubleEndedIterator + ExactSizeIterator { ... }
}

Required Associated Types§

Required Methods§

Source

fn num_nodes(&self) -> usize

Returns the total number of nodes in this graph.

Several graph algorithm implementations assume that every node ID is strictly less than the number of nodes, i.e. nodes are densely numbered. That assumption allows them to use num_nodes to allocate per-node data structures, indexed by node.

Provided Methods§

Source

fn iter_nodes( &self, ) -> impl Iterator<Item = Self::Node> + DoubleEndedIterator + ExactSizeIterator

Iterates over all nodes of a graph in ascending numeric order.

Assumes that nodes are densely numbered, i.e. every index in 0..num_nodes is a valid node.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'graph, G: DirectedGraph> DirectedGraph for &'graph G

Implementors§

Source§

impl<G: DirectedGraph> DirectedGraph for ReversedGraph<G>

Source§

impl<N: Idx, S: Idx + Ord, A: Annotation> DirectedGraph for Sccs<N, S, A>

Source§

type Node = S

Source§

impl<N: Idx, const BR: bool> DirectedGraph for VecGraph<N, BR>

Source§

type Node = N

impl<'a, 'tcx, D: ConstraintGraphDirection> DirectedGraph for RegionGraph<'a, 'tcx, D>

impl<'tcx> DirectedGraph for BasicBlocks<'tcx>

impl<'a, 'tcx> DirectedGraph for CoverageRelevantSubgraph<'a, 'tcx>