Expand description
Cocycle is a general-purpose topological data analysis library in pure Rust.
Computes Vietoris-Rips persistent homology in arbitrary dimensions over prime fields and descriptors and matching distances of persistence diagrams. Constructs exact threshold graphs and computes supplied weighted flag filtrations with sparse adjacency access and explicit original-input coverage. Accepts supplied simplicial and filtered-cell complexes, including signed filtration values and unequal vertex births. Algorithms are implemented in Rust without a foreign TDA backend or runtime dependencies.
§Status
Implicit Rips computation uses a specialized F2 H0/H1 engine and prime-field cohomology with clearing for other requests. Explicit builder results and supplied complexes use boundary reduction. Rips expansion provides frozen simplices and oriented incidence queries. Generic filtered-cell inputs return diagrams; concrete simplicial sources also support vertex-labelled representatives. Requested cycle/cocycle representatives use production boundary reduction; independent test oracles verify ranks and interval semantics. Work and memory can still grow substantially with input size and reduction fill-in. See the mathematical specification and benchmark records for limits.
use cocycle::descriptors::betti_curve;
use cocycle::geometry::PointCloudView;
use cocycle::filtration::RipsBuilder;
use cocycle::persistence::PersistenceExt;
let coordinates = [0., 0., 1., 0., 1., 1., 0., 1.];
let points = PointCloudView::new(&coordinates, 4, 2)?;
let result = RipsBuilder::from_points(points).persistence().compute()?;
let diagram = result.diagram();
assert_eq!(betti_curve(diagram, 1, &[0., 1., 2.])?, [0, 1, 0]);Modules§
- algebra
- Validated coefficient fields; private sparse arithmetic used by persistence.
- complex
- Validated topology storage and a read-only filtered-cell contract. A simplex is one cell; a simplicial complex is a face-closed collection.
- descriptors
- Statistics and curves computed from an existing persistence diagram.
- diagram
- Owned persistence intervals and their computation range.
- diagram_
distances - Exact matching distances between complete persistence diagrams.
- execution
- Cooperative controls shared by construction and analysis operations.
- filtration
- Filtration construction, provenance and shared implicit access.
- geometry
- Borrowed, validated numerical inputs.
- persistence
- Persistent homology computations and owned result assembly.
Enums§
- Error
- A recoverable input, configuration or result error.
Type Aliases§
- Result
- The result type returned by fallible Cocycle operations.