pub struct ReferenceGraph {
pub model: String,
pub vertices: IndexMap<String, ReferenceVertex>,
pub edges: Vec<ReferenceEdge>,
/* private fields */
}Expand description
The resolved reference DAG for one model — the partition pass’s input.
Edges point from a vertex to a vertex it depends on, so a bottom-up
(topological_order) walk visits each
vertex after its dependencies — the order class(n) = max(class(inputs))
propagation needs.
Fields§
§model: String§vertices: IndexMap<String, ReferenceVertex>§edges: Vec<ReferenceEdge>Implementations§
Source§impl ReferenceGraph
impl ReferenceGraph
Sourcepub fn dependencies(&self, key: &str) -> Vec<String>
pub fn dependencies(&self, key: &str) -> Vec<String>
Vertices key references / depends on (its out-neighbours).
Sourcepub fn dependents(&self, key: &str) -> Vec<String>
pub fn dependents(&self, key: &str) -> Vec<String>
Vertices that reference / depend on key (its in-neighbours).
Sourcepub fn edges_of_kind(&self, kind: EdgeKind) -> Vec<&ReferenceEdge>
pub fn edges_of_kind(&self, kind: EdgeKind) -> Vec<&ReferenceEdge>
All edges of a given kind, in insertion order.
Sourcepub fn detect_cycle(&self) -> Option<Vec<String>>
pub fn detect_cycle(&self) -> Option<Vec<String>>
Return a reference cycle as a vertex-key path ([v, …, v]), or None.
Three-colour DFS over the dependency edges, deterministic (sorted vertices, sorted neighbours).
Sourcepub fn topological_order(&self) -> Result<Vec<String>, ReferenceResolutionError>
pub fn topological_order(&self) -> Result<Vec<String>, ReferenceResolutionError>
Bottom-up order (dependencies before dependents).
Errors with ReferenceResolutionError::ReferenceCycle if the graph is cyclic —
a cycle among reference edges is an out-of-scope implicit/iterative solve
(RFC §6.1 “Acyclicity”).
Trait Implementations§
Source§impl Clone for ReferenceGraph
impl Clone for ReferenceGraph
Source§impl Debug for ReferenceGraph
impl Debug for ReferenceGraph
Auto Trait Implementations§
impl Freeze for ReferenceGraph
impl RefUnwindSafe for ReferenceGraph
impl Send for ReferenceGraph
impl Sync for ReferenceGraph
impl Unpin for ReferenceGraph
impl UnsafeUnpin for ReferenceGraph
impl UnwindSafe for ReferenceGraph
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Context for T
impl<T> Context for T
fn vector_from_element<V>(&self, len: usize, value: <V as VectorCommon>::T) -> Vwhere
V: Vector<C = Self>,
fn vector_from_vec<V>(&self, vec: Vec<<V as VectorCommon>::T>) -> Vwhere
V: Vector<C = Self>,
fn vector_zeros<V>(&self, len: usize) -> Vwhere
V: Vector<C = Self>,
fn dense_mat_zeros<V>(
&self,
rows: usize,
cols: usize,
) -> <V as DefaultDenseMatrix>::Mwhere
V: Vector<C = Self> + DefaultDenseMatrix,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.