Skip to main content

ElementSuccessors

Trait ElementSuccessors 

Source
pub trait ElementSuccessors: TopologyBase {
    type Successors<'view>: Iterator<Item = Self::ElementId>
       where Self: 'view;

    // Required method
    fn element_successors(
        &self,
        element: Self::ElementId,
    ) -> Self::Successors<'_>;
}
Expand description

Capability for expanding an element to its directed successor elements.

This is the substrate-neutral form of “follow outgoing connections from this element.” For binary graphs the successors are the targets of outgoing edges; for hypergraphs they are the vertices reachable through outgoing hyperedges. Substrate-agnostic algorithms (forward BFS, forward reachability) bind on this trait so the same code drives any topology view that can answer the question.

Implementations define whether parallel connections produce repeated successor elements. Implementations that preserve multiplicity should document that behavior; consumers that need set semantics should deduplicate at their own level.

§Performance

Creating the iterator should be O(1) unless an implementation documents a weaker contract. Yielding k successors should be O(k) and should not allocate unless the implementation documents otherwise.

Required Associated Types§

Source

type Successors<'view>: Iterator<Item = Self::ElementId> where Self: 'view

Iterator over successor element IDs reached from one element.

§Performance

Advancing the iterator should be amortized O(1) unless an implementation documents otherwise.

Required Methods§

Source

fn element_successors(&self, element: Self::ElementId) -> Self::Successors<'_>

Returns elements reachable through outgoing connections from element.

§Performance

Expected O(1) to create the iterator; yielding k successors is expected O(k).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§