Skip to main content

InducedDag

Struct InducedDag 

Source
pub struct InducedDag { /* private fields */ }
Expand description

The open DAG a compositional model induces (Lorenz & Tull, arXiv:2602.16612, Example 61): one vertex per node of the model’s grouping, one edge per wire leaving one node and entering another. Derived, never stored beside the model.

The graph is a plain adjacency set with the reachability queries the abstraction layer needs: parents and children for the structural precheck, blocked reachability for Definition 49’s α(X), plain reachability for the parallelisable test of §7.2, and a cycle test for build().

Implementations§

Source§

impl InducedDag

Source

pub fn new(n: usize) -> Self

An edgeless graph on n vertices.

Source

pub fn add_edge(&mut self, a: usize, b: usize) -> &mut Self

Adds the edge a → b. Out-of-range endpoints are ignored, so a caller building from a validated model never sees a panic here.

Source

pub fn num_vertices(&self) -> usize

The vertex count.

Source

pub fn edges(&self) -> impl Iterator<Item = (usize, usize)> + '_

The edges, ascending.

Source

pub fn num_edges(&self) -> usize

The edge count.

Source

pub fn has_edge(&self, a: usize, b: usize) -> bool

Whether a → b is an edge.

Source

pub fn parents(&self, v: usize) -> Vec<usize>

The parents of v, ascending.

Source

pub fn children(&self, v: usize) -> Vec<usize>

The children of v, ascending.

Source

pub fn reaches(&self, a: usize, b: usize) -> bool

Whether a directed path of at least one edge runs from a to b.

Source

pub fn reaches_avoiding( &self, start: usize, targets: &BTreeSet<usize>, blocked: &BTreeSet<usize>, ) -> bool

Whether some vertex of targets is reached from start along a directed path none of whose vertices, start included, lies in blocked. A start in targets counts through the empty path, which is Definition 49’s π(X) ⊆ α(X).

Source

pub fn has_cycle(&self) -> bool

Whether the graph has a directed cycle.

Source

pub fn topological_order(&self) -> Option<Vec<usize>>

A topological order, or None if the graph has a cycle. Kahn’s algorithm, ties broken by ascending vertex.

Trait Implementations§

Source§

impl Clone for InducedDag

Source§

fn clone(&self) -> InducedDag

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for InducedDag

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for InducedDag

Source§

impl PartialEq for InducedDag

Source§

fn eq(&self, other: &InducedDag) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for InducedDag

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<Borrowed> SampleBorrow<Borrowed> for Borrowed

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.