Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
8642b31
docs: Added JOSS guidelines and sample paper.
marvin-hansen Jan 9, 2026
d2a9c4b
doc: Updated the AI guidelines.
marvin-hansen Jan 9, 2026
46f84a6
docs: Added initial project summary as prepeartion for the JOSS paper.
marvin-hansen Jan 9, 2026
6c8a123
docs: Formatted markdown.
marvin-hansen Jan 9, 2026
5cf835c
docs: First draft of JOSS paper.
marvin-hansen Jan 9, 2026
1193a28
docs: Added specs for Lattice Gauge Field
marvin-hansen Jan 10, 2026
55e4ce5
feat(deep_causality_topology): Initial implementation of Lattice Gaug…
marvin-hansen Jan 11, 2026
4ea1e65
test(deep_causality_topology): Tested initial implementation of Latti…
marvin-hansen Jan 11, 2026
2027349
test(deep_causality_topology): Reviewed initial implementation of Lat…
marvin-hansen Jan 11, 2026
4ad8243
feat(deep_causality_topology): Updated and revised implementation of …
marvin-hansen Jan 11, 2026
0ab1c2d
feat(deep_causality_topology): Updated and revised implementation of …
marvin-hansen Jan 11, 2026
e6ec05f
doc(deep_causality_topology): Documented and revised Lattice Gauge F…
marvin-hansen Jan 11, 2026
dd21a0f
doc(deep_causality_topology): Added exaple for Lattice Gauge Field impl.
marvin-hansen Jan 11, 2026
8432144
docs: Archived completed specs.
marvin-hansen Jan 11, 2026
2efc202
doc(deep_causality_topology): Updated SBOM
marvin-hansen Jan 11, 2026
c4bb8c9
Merge branch 'deepcausality-rs:main' into main
marvin-hansen Jan 11, 2026
05d5a1d
test(deep_causality_topology): Increasded test coverage.
marvin-hansen Jan 11, 2026
8d031c9
test(deep_causality_topology): Increasded test coverage, applied lint…
marvin-hansen Jan 11, 2026
8834745
fix(deep_causality_topology): Applied lints and fixes.
marvin-hansen Jan 11, 2026
b9764fc
test(deep_causality_topology): Increasded test coverage, applied lint…
marvin-hansen Jan 11, 2026
d7f541b
test(deep_causality_topology): Increased test coverage, applied lints…
marvin-hansen Jan 11, 2026
875bbfa
test(deep_causality_topology): Increased test coverage, applied lints…
marvin-hansen Jan 11, 2026
0792607
test(deep_causality_topology): Applied lints and fixes.
marvin-hansen Jan 11, 2026
935c002
test(deep_causality_topology): Applied lints and fixes.
marvin-hansen Jan 11, 2026
613a325
test(deep_causality_topology): Applied lints and fixes.
marvin-hansen Jan 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ use crate::{
use deep_causality_metric::{LorentzianMetric, WestCoastMetric};
use deep_causality_num::RealField;
use deep_causality_tensor::{CausalTensor, TensorData};
use deep_causality_topology::GaugeFieldWitness;
use deep_causality_topology::{BaseTopology, GaugeField, Manifold, U1};
use deep_causality_topology::{BaseTopology, GaugeField, GaugeFieldWitness, Manifold, U1};

impl<S> ElectroweakOps<S> for ElectroweakField<S>
where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use deep_causality_physics::theories::general_relativity::{GrOps, schwarzschild_
use deep_causality_physics::{NEWTONIAN_CONSTANT_OF_GRAVITATION, SPEED_OF_LIGHT};
use deep_causality_tensor::CausalTensor;
use deep_causality_topology::{GaugeField, Manifold, Simplex, SimplicialComplexBuilder};

// ============================================================================
// GR Gauge Field Integration Tests
// ============================================================================
Expand Down
1 change: 1 addition & 0 deletions deep_causality_topology/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ rust_library(
"//deep_causality_metric",
"//deep_causality_multivector",
"//deep_causality_num",
"//deep_causality_rand",
"//deep_causality_sparse",
"//deep_causality_tensor",
],
Expand Down
29 changes: 23 additions & 6 deletions deep_causality_topology/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ path = "src/lib.rs"
[features]
# Default means CPU execution
default = []
# Enables random number generator from the host OS for secure random numbers.
# Enabling os-random adds an indirect depdency on getrandom and libc.
# Disabled by default to use native Rust prng instead.
os-random = ["deep_causality_rand/os-random"]
# MLX acceleration for Apple Silicon (M Series).
# Forwards to deep_causality_tensor/mlx and deep_causality_multivector/mlx
# for MLX / GPU-accelerated operations.
Expand All @@ -35,6 +39,10 @@ path = "../deep_causality_num"
version = "0.1.12"
default-features = false

[dependencies.deep_causality_rand]
path = "../deep_causality_rand"
version = "0.1"

[dependencies.deep_causality_sparse]
path = "../deep_causality_sparse"
version = "0.1.4"
Expand Down Expand Up @@ -64,20 +72,29 @@ name = "basic_graph"
path = "examples/basic_graph.rs"

[[example]]
name = "manifold_analysis"
path = "examples/manifold_analysis.rs"
name = "chain_algebra"
path = "examples/chain_algebra.rs"

[[example]]
name = "complex_operators"
path = "examples/complex_operators.rs"

[[example]]
name = "differential_field"
path = "examples/differential_field.rs"

[[example]]
name = "hkt_graph_convolution"
path = "examples/hkt_graph_convolution.rs"

[[example]]
name = "chain_algebra"
path = "examples/chain_algebra.rs"
name = "lattice_gauge_simulation"
path = "examples/lattice_gauge_simulation.rs"

[[example]]
name = "differential_field"
path = "examples/differential_field.rs"
name = "manifold_analysis"
path = "examples/manifold_analysis.rs"


[[bench]]
name = "bench_causal_topology"
Expand Down
128 changes: 76 additions & 52 deletions deep_causality_topology/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,60 @@

**Topological Data Analysis (TDA) and Causal Geometry for Rust**

`deep_causality_topology` is a core crate of the `deep_causality` project, providing rigorous topological data structures and algorithms for causal modeling, geometric deep learning, and complex systems analysis.
`deep_causality_topology` is a core crate of the `deep_causality` project, providing rigorous topological data
structures and algorithms for causal modeling, geometric deep learning, and complex systems analysis.

It bridges the gap between discrete data (graphs, point clouds) and continuous geometric structures (manifolds, simplicial complexes), enabling advanced reasoning about the "shape" and connectivity of causal systems.
It bridges the gap between discrete data (graphs, point clouds) and continuous geometric structures (manifolds,
simplicial complexes), enabling advanced reasoning about the "shape" and connectivity of causal systems.

## Features

* **Comprehensive Topological Types**:
* **Graph**: Efficient sparse-matrix based graphs for causal networks.
* **Hypergraph**: Modeling higher-order relationships (hyperedges) between multiple nodes.
* **SimplicialComplex**: Generalizing graphs to higher dimensions (triangles, tetrahedra) to capture voids and holes.
* **Manifold**: Validated geometric structures for differential geometry operations.
* **PointCloud**: Raw multi-dimensional data with Vietoris-Rips triangulation capabilities.
* **Topological Algorithms**:
* **Vietoris-Rips Triangulation**: Convert point clouds into simplicial complexes at a given scale.
* **Euler Characteristic**: Compute topological invariants ($\chi$) to classify shapes (e.g., healthy vs. pathological tissue).
* **Boundary/Coboundary Operators**: Sparse matrix operators for algebraic topology computations.
* **Algebraic Topology & Differential Geometry**:
* **Chain Algebra**: Perform algebraic operations on chains (formal sums of simplices) and verify fundamental topological theorems like `∂∂=0`.
* **Differential Operators**: Compute the exterior derivative (`d`), Hodge star (`⋆`), codifferential (`δ`), and Hodge-Laplacian (`Δ`) on discrete differential forms.
* **Hodge Theory**: Detect topological features like holes and voids by finding harmonic forms (solutions to `Δω = 0`).
* **Higher-Kinded Types (HKT)**:
* Implements `Functor`, `BoundedComonad` (Extract/Extend), and `BoundedAdjunction` (Unit/Counit) via `deep_causality_haft`.
* Enables functional geometric patterns like "neighborhood extraction" (Comonad) and "geometric realization" (Adjunction).
* **Comprehensive Topological Types**:
* **Graph**: Efficient sparse-matrix based graphs for causal networks.
* **Hypergraph**: Modeling higher-order relationships (hyperedges) between multiple nodes.
* **SimplicialComplex**: Generalizing graphs to higher dimensions (triangles, tetrahedra) to capture voids and
holes.
* **Manifold**: Validated geometric structures for differential geometry operations.
* **PointCloud**: Raw multi-dimensional data with Vietoris-Rips triangulation capabilities.
* **Topological Algorithms**:
* **Vietoris-Rips Triangulation**: Convert point clouds into simplicial complexes at a given scale.
* **Euler Characteristic**: Compute topological invariants ($\chi$) to classify shapes (e.g., healthy vs.
pathological tissue).
* **Boundary/Coboundary Operators**: Sparse matrix operators for algebraic topology computations.
* **Algebraic Topology & Differential Geometry**:
* **Chain Algebra**: Perform algebraic operations on chains (formal sums of simplices) and verify fundamental
topological theorems like `∂∂=0`.
* **Differential Operators**: Compute the exterior derivative (`d`), Hodge star (`⋆`), codifferential (`δ`), and
Hodge-Laplacian (`Δ`) on discrete differential forms.
* **Hodge Theory**: Detect topological features like holes and voids by finding harmonic forms (solutions to
`Δω = 0`).
* **Higher-Kinded Types (HKT)**:
* Implements `Functor`, `BoundedComonad` (Extract/Extend), and `BoundedAdjunction` (Unit/Counit) via
`deep_causality_haft`.
* Enables functional geometric patterns like "neighborhood extraction" (Comonad) and "geometric realization" (
Adjunction).

## Core Concepts

| Type | Description | Mathematical Structure |
| :--- | :--- | :--- |
| **PointCloud** | Set of points in $\mathbb{R}^n$ with metadata. | Discrete Metric Space |
| **Graph** | Nodes and binary edges. | 1-Complex |
| **Hypergraph** | Nodes and hyperedges (subsets of nodes). | Hypergraph |
| **SimplicialComplex** | Collection of simplices (points, lines, triangles...) closed under sub-simplices. | Simplicial Complex $K$ |
| **Manifold** | A topological space that is locally Euclidean. | Manifold $M$ |
| Type | Description | Mathematical Structure |
|:----------------------|:----------------------------------------------------|:----------------------------|
| **PointCloud** | Set of points in $\mathbb{R}^n$ with metadata. | Discrete Metric Space |
| **Graph** | Nodes and binary edges. | 1-Complex |
| **Hypergraph** | Nodes and hyperedges (subsets of nodes). | Hypergraph |
| **SimplicialComplex** | Collection of simplices closed under sub-simplices. | Simplicial Complex $K$ |
| **Manifold** | A topological space that is locally Euclidean. | Manifold $M$ |
| **Lattice** | Regular discrete grid with periodic boundaries. | $\mathbb{Z}^D$ Lattice |
| **CellComplex** | Generalized simplicial complex (CW-complex). | CW-Complex |
| **Chain** | Formal sum of simplices for algebraic topology. | Chain Group $C_n$ |
| **Skeleton** | k-skeleton of a complex (simplices up to dim k). | Skeleton $K^{(k)}$ |
| **Simplex** | Basic building block (vertex, edge, triangle...). | $n$-Simplex |
| **Topology** | Abstract topological space with graded data. | Graded Vector Space |
| **DifferentialForm** | Discrete differential k-forms on a complex. | $\Omega^k(M)$ |
| **CurvatureTensor** | Riemann/Ricci curvature tensor. | $R^{\mu}_{\nu\rho\sigma}$ |
| **ReggeGeometry** | Discrete gravity via deficit angles. | Regge Calculus |
| **GaugeField** | Gauge field on a manifold (connections). | Principal Bundle Connection |
| **LatticeGaugeField** | Wilson-formulation lattice gauge theory. | $U_\mu(n) \in G$ |
| **LinkVariable** | Group element on a lattice edge. | $\text{SU}(N)$ Element |

## Usage

Expand All @@ -57,9 +78,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
// Adjacency: 0->1, 1->2
let adj = CsrMatrix::from_triplets(3, 3, &[(0, 1, 1), (1, 2, 1)])?;
let data = CausalTensor::new(vec![1.0, 2.0, 3.0], vec![3])?;

let graph = Graph::new(adj, data, 0)?;

println!("Neighbors of 1: {:?}", graph.get_neighbors(1)?);
Ok(())
}
Expand Down Expand Up @@ -88,15 +109,15 @@ Convert raw sensor data into structured geometry to detect anomalies (e.g., tumo
use deep_causality_topology::PointCloud;

// 1. Ingest Raw MRI Data
let pc = PointCloud::new(points_tensor, metadata, 0)?;
let pc = PointCloud::new(points_tensor, metadata, 0) ?;

// 2. Triangulate (Vietoris-Rips)
let complex = pc.triangulate(0.6)?;
let complex = pc.triangulate(0.6) ?;

// 3. Diagnose based on Topology
let chi = complex.euler_characteristic();
if chi <= 0 {
println!("Pathological: Detected Void/Necrosis");
println ! ("Pathological: Detected Void/Necrosis");
}
```

Expand All @@ -113,35 +134,37 @@ use deep_causality_topology::{Manifold, PointCloud};

// Time-step the heat equation: ∂u/∂t = -Δu
for _ in 0..num_steps {
let laplacian = manifold.laplacian(0);
// ... update data using: new_data = current_data - dt * laplacian
let laplacian = manifold.laplacian(0);
// ... update data using: new_data = current_data - dt * laplacian
}
```

## Higher-Kinded Types (HKT)

This crate leverages `deep_causality_haft` to provide functional geometric abstractions.

* **Functor**: Map functions over the data stored in the topology (e.g., transform node weights).
* **BoundedComonad (Extract/Extend)**:
* *Extract*: Get the value at the current "cursor" (focus).
* *Extend*: Apply a local computation (convolution) over the neighborhood of every point to produce a new topology. This is the foundation of **Graph Neural Networks (GNNs)** and **Cellular Automata**.
* **BoundedAdjunction (Unit/Counit)**:
* *Unit*: Embed discrete data into a topological structure.
* *Counit*: Project/Integrate topological data back into a flat representation.
* **Functor**: Map functions over the data stored in the topology (e.g., transform node weights).
* **BoundedComonad (Extract/Extend)**:
* *Extract*: Get the value at the current "cursor" (focus).
* *Extend*: Apply a local computation (convolution) over the neighborhood of every point to produce a new topology.
This is the foundation of **Graph Neural Networks (GNNs)** and **Cellular Automata**.
* **BoundedAdjunction (Unit/Counit)**:
* *Unit*: Embed discrete data into a topological structure.
* *Counit*: Project/Integrate topological data back into a flat representation.

## Examples

| File Name | Description | Engineering Value |
| :--- | :--- | :--- |
| `basic_graph.rs` | Graph construction & traversal | Foundation for large-scale causal network modeling. |
| `manifold_analysis.rs` | 1-Manifold validation & Euler Char. | Ensuring geometric validity for differential operators. |
| `point_cloud_triangulation.rs` | MRI Tissue Segmentation | Bridging raw sensor data with topological reasoning for diagnosis. |
| `chain_algebra.rs` | Chain complex algebra & `∂∂=0` | Foundational verification for homological algebra. |
| `differential_field.rs` | Solving the Heat Equation on a manifold | Simulating physical diffusion processes on complex shapes. |
| `hodge_theory.rs` | Finding harmonic forms to detect holes | Advanced topological feature detection using the Hodge-Laplacian. |
| File Name | Description | Engineering Value |
|:-------------------------------|:----------------------------------------|:-------------------------------------------------------------------|
| `basic_graph.rs` | Graph construction & traversal | Foundation for large-scale causal network modeling. |
| `manifold_analysis.rs` | 1-Manifold validation & Euler Char. | Ensuring geometric validity for differential operators. |
| `point_cloud_triangulation.rs` | MRI Tissue Segmentation | Bridging raw sensor data with topological reasoning for diagnosis. |
| `chain_algebra.rs` | Chain complex algebra & `∂∂=0` | Foundational verification for homological algebra. |
| `differential_field.rs` | Solving the Heat Equation on a manifold | Simulating physical diffusion processes on complex shapes. |
| `hodge_theory.rs` | Finding harmonic forms to detect holes | Advanced topological feature detection using the Hodge-Laplacian. |

To run examples:

```bash
cargo run -p deep_causality_topology --example point_cloud_triangulation
```
Expand All @@ -152,10 +175,11 @@ This project is licensed under the [MIT license](LICENSE).

## Security

For details about security, please read the [security policy](https://github.com/deepcausality-rs/deep_causality/blob/main/SECURITY.md).
For details about security, please read
the [security policy](https://github.com/deepcausality-rs/deep_causality/blob/main/SECURITY.md).

## Author

* [Marvin Hansen](https://github.com/marvin-hansen).
* Github GPG key ID: 369D5A0B210D39BC
* GPG Fingerprint: 4B18 F7B2 04B9 7A72 967E 663E 369D 5A0B 210D 39BC
* [Marvin Hansen](https://github.com/marvin-hansen).
* Github GPG key ID: 369D5A0B210D39BC
* GPG Fingerprint: 4B18 F7B2 04B9 7A72 967E 663E 369D 5A0B 210D 39BC
Loading
Loading