pub struct FlowNetwork {
pub modules: Vec<ModuleId>,
pub flows: Vec<EntropyFlow>,
}Expand description
A flow network on a module dependency graph.
Fields§
§modules: Vec<ModuleId>All module IDs.
flows: Vec<EntropyFlow>Directed entropy flows.
Implementations§
Source§impl FlowNetwork
impl FlowNetwork
Sourcepub fn new(flows: Vec<EntropyFlow>) -> Self
pub fn new(flows: Vec<EntropyFlow>) -> Self
Build a flow network from a list of flows.
Sourcepub fn net_flow(&self) -> HashMap<ModuleId, f64>
pub fn net_flow(&self) -> HashMap<ModuleId, f64>
Compute net flow at each node: outflow - inflow.
For a conserved flow, net flow = 0 at every internal node.
Sourcepub fn check_conservation(&self) -> (bool, f64)
pub fn check_conservation(&self) -> (bool, f64)
Check Kirchhoff’s current law: total inflow = total outflow at each node.
Returns (is_conserved, max_violation).
Sourcepub fn total_flow(&self) -> f64
pub fn total_flow(&self) -> f64
Total flow magnitude.
Sourcepub fn adjacency_matrix(&self) -> (usize, Array2<f64>)
pub fn adjacency_matrix(&self) -> (usize, Array2<f64>)
Build the flow adjacency matrix (n×n) for spectral analysis.
Trait Implementations§
Source§impl Clone for FlowNetwork
impl Clone for FlowNetwork
Source§fn clone(&self) -> FlowNetwork
fn clone(&self) -> FlowNetwork
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FlowNetwork
impl Debug for FlowNetwork
Source§impl<'de> Deserialize<'de> for FlowNetwork
impl<'de> Deserialize<'de> for FlowNetwork
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for FlowNetwork
impl RefUnwindSafe for FlowNetwork
impl Send for FlowNetwork
impl Sync for FlowNetwork
impl Unpin for FlowNetwork
impl UnsafeUnpin for FlowNetwork
impl UnwindSafe for FlowNetwork
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
Mutably borrows from an owned value. Read more