exo-hypergraph
Hypergraph substrate for higher-order relational reasoning in the EXO-AI cognitive substrate.
Features
- Hyperedge Support: Relations spanning multiple entities (not just pairwise)
- Topological Data Analysis: Persistent homology and Betti number computation (interface ready, full algorithms to be implemented)
- Sheaf Theory: Consistency checks for distributed data structures
- Thread-Safe: Lock-free concurrent access using DashMap
Architecture
This crate implements the hypergraph layer as described in the EXO-AI architecture:
HypergraphSubstrate
├── HyperedgeIndex # Efficient indexing for hyperedge queries
├── SimplicialComplex # TDA structures and Betti numbers
└── SheafStructure # Sheaf-theoretic consistency checking
Usage
use ;
use ;
// Create hypergraph
let config = default;
let mut hypergraph = new;
// Add entities
let e1 = new;
let e2 = new;
let e3 = new;
hypergraph.add_entity;
hypergraph.add_entity;
hypergraph.add_entity;
// Create 3-way hyperedge (beyond pairwise!)
let relation = Relation ;
let hyperedge_id = hypergraph.create_hyperedge.unwrap;
// Query topology
let betti = hypergraph.betti_numbers; // Get Betti numbers β₀, β₁, β₂
println!;
Topological Queries
Betti Numbers
Betti numbers are topological invariants that describe the structure:
- β₀: Number of connected components
- β₁: Number of 1-dimensional holes (loops)
- β₂: Number of 2-dimensional holes (voids)
let betti = hypergraph.betti_numbers;
// β₀ = connected components
// β₁ = loops (currently returns 0 - stub)
// β₂ = voids (currently returns 0 - stub)
Persistent Homology (Interface Ready)
The persistent homology interface is implemented, with full algorithm to be added:
use TopologicalQuery;
let query = PersistentHomology ;
let result = hypergraph.query.unwrap;
// Returns persistence diagram (currently empty - stub)
Implementation Status
✅ Complete:
- Hyperedge creation and indexing
- Entity-to-hyperedge queries
- Simplicial complex construction
- Betti number computation (β₀)
- Sheaf consistency checking
- Thread-safe concurrent access
🚧 Stub Interfaces (Complex algorithms, interfaces ready):
- Persistent homology computation (requires boundary matrix reduction)
- Higher Betti numbers (β₁, β₂, ...) require Smith normal form
- Filtration building for persistence
Dependencies
exo-core: Core types and traitspetgraph: Graph algorithmsdashmap: Concurrent hash mapsserde: Serialization
Links
License
MIT OR Apache-2.0