pub struct NetworkGraph { /* private fields */ }Expand description
A network view that also steps THROUGH elements, not just between them.
IfcRelConnectsPorts joins one element’s port to another’s. It never
joins an element’s OWN ports to each other: the fact that fluid entering
a pipe’s inlet leaves by its outlet is implied by the element, not stated
by any relationship.
So the raw connection graph of a real chain
[seg0] out --- in [seg1] out --- in [fitting]has NO path from seg0’s inlet to seg1 at all: every connection is an isolated pair. Answering “what is downstream of this pipe” needs both kinds of edge – across connections AND through elements.
This is the distinction between the two, made explicit rather than
silently folded into ConnectionGraph.
Implementations§
Source§impl NetworkGraph
impl NetworkGraph
Sourcepub fn build(graph: &ConnectionGraph, ports: &[Port]) -> Self
pub fn build(graph: &ConnectionGraph, ports: &[Port]) -> Self
Combine stated connections with through-element port pairing.
ports supplies each port’s owning element, which is what makes the
through-element edges knowable.
Sourcepub fn reachable_from(&self, start: EntityId) -> Vec<EntityId>
pub fn reachable_from(&self, start: EntityId) -> Vec<EntityId>
Every port reachable from start, including start.
Cycle-safe: ring mains are normal, so a visited set is required, not an optimisation.
Sourcepub fn components(&self) -> Vec<Vec<EntityId>>
pub fn components(&self) -> Vec<Vec<EntityId>>
Connected components, each sorted, components ascending.