pub struct VietorisRipsComplex {
pub points: Vec<Vec<f64>>,
pub epsilon: f64,
pub simplices: Vec<Vec<usize>>,
}Expand description
A Vietoris-Rips simplicial complex at a fixed scale epsilon.
Unlike VietorisRips (which computes the full persistent homology
across all scales), this struct stores the explicit list of simplices
formed when all pairwise distances ≤ epsilon.
§Example
use scirs2_transform::tda_ext::VietorisRipsComplex;
let pts = vec![
vec![0.0, 0.0],
vec![1.0, 0.0],
vec![1.0, 1.0],
vec![0.0, 1.0],
];
let vrc = VietorisRipsComplex::new(&pts, 1.5).expect("should succeed");
assert!(vrc.n_simplices(0) == 4); // four 0-simplices (vertices)
assert!(vrc.euler_characteristic() != 0); // non-trivial topologyFields§
§points: Vec<Vec<f64>>Input point cloud
epsilon: f64Scale parameter (all edges with length ≤ epsilon are included)
simplices: Vec<Vec<usize>>All simplices (sorted by dimension then by vertex tuple)
Implementations§
Source§impl VietorisRipsComplex
impl VietorisRipsComplex
Sourcepub fn new(points: &[Vec<f64>], epsilon: f64) -> Result<Self>
pub fn new(points: &[Vec<f64>], epsilon: f64) -> Result<Self>
Construct the Vietoris-Rips complex for the given point cloud at scale epsilon.
Only simplices up to dimension 2 (triangles) are computed for tractability.
§Arguments
points— slice of point vectors (all of equal length)epsilon— maximum edge length to include
Sourcepub fn n_simplices(&self, dim: usize) -> usize
pub fn n_simplices(&self, dim: usize) -> usize
Count the number of simplices of a given dimension.
Dimension 0 = vertices, 1 = edges, 2 = triangles.
Sourcepub fn euler_characteristic(&self) -> i64
pub fn euler_characteristic(&self) -> i64
Compute the Euler characteristic χ = Σ_k (-1)^k * C_k, where C_k is the number of k-simplices.
Sourcepub fn are_connected(&self, u: usize, v: usize) -> bool
pub fn are_connected(&self, u: usize, v: usize) -> bool
Check whether two vertices are connected by an edge in the complex.
Trait Implementations§
Source§impl Clone for VietorisRipsComplex
impl Clone for VietorisRipsComplex
Source§fn clone(&self) -> VietorisRipsComplex
fn clone(&self) -> VietorisRipsComplex
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for VietorisRipsComplex
impl RefUnwindSafe for VietorisRipsComplex
impl Send for VietorisRipsComplex
impl Sync for VietorisRipsComplex
impl Unpin for VietorisRipsComplex
impl UnsafeUnpin for VietorisRipsComplex
impl UnwindSafe for VietorisRipsComplex
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
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.