mod creation;
mod meter_roles;
mod retrieval;
mod validation;
mod formulas;
pub mod iterators;
use crate::{ComponentGraphConfig, Edge, Node};
pub use formulas::{AggregationFormula, CoalesceFormula, Formula};
use petgraph::graph::{DiGraph, NodeIndex};
use std::collections::HashMap;
pub(crate) type NodeIndexMap = HashMap<u64, NodeIndex>;
pub(crate) type EdgeMap<E> = HashMap<(NodeIndex, NodeIndex), E>;
pub struct ComponentGraph<N, E>
where
N: Node,
E: Edge,
{
graph: DiGraph<N, ()>,
node_indices: NodeIndexMap,
root_id: u64,
edges: EdgeMap<E>,
config: ComponentGraphConfig,
}
impl<N, E> Clone for ComponentGraph<N, E>
where
N: Node + Clone,
E: Edge + Clone,
{
fn clone(&self) -> Self {
Self {
graph: self.graph.clone(),
node_indices: self.node_indices.clone(),
root_id: self.root_id,
edges: self.edges.clone(),
config: self.config.clone(),
}
}
}
#[cfg(test)]
mod test_utils;