use super::{SparseRips, SparseRipsAccess};
use crate::Result;
use crate::complex::SimplicialComplex;
use crate::filtration::RipsInputKind;
use crate::filtration::{Coverage, RipsApproximation};
#[derive(Clone, Debug)]
pub struct SparseRipsExpansion {
pub(crate) complex: SimplicialComplex,
pub(crate) metadata: RipsApproximation,
pub(crate) coverage: Coverage,
pub(crate) kind: RipsInputKind,
pub(crate) max_simplex_dimension: usize,
pub(crate) complete: bool,
pub(crate) max_edge: f64,
}
impl SparseRipsExpansion {
pub fn complex(&self) -> &SimplicialComplex {
&self.complex
}
pub fn approximation(&self) -> &RipsApproximation {
&self.metadata
}
pub fn coverage(&self) -> Coverage {
self.coverage
}
pub fn input_kind(&self) -> RipsInputKind {
self.kind
}
pub fn max_simplex_dimension(&self) -> usize {
self.max_simplex_dimension
}
pub fn is_dimension_complete(&self) -> bool {
self.complete
}
}
impl SparseRips {
pub fn expand(&self, max_simplex_dimension: usize) -> Result<SparseRipsExpansion> {
let access = SparseRipsAccess {
input: self,
cutoff: self.graph.max_edge(),
};
let (complex, complete) =
crate::filtration::flag::expand_access(&access, max_simplex_dimension)?;
Ok(SparseRipsExpansion {
complex,
complete,
max_simplex_dimension,
metadata: self.metadata.clone(),
coverage: self.coverage,
kind: self.kind,
max_edge: self.graph.max_edge(),
})
}
}