Crate exo_hypergraph

Crate exo_hypergraph 

Source
Expand description

Hypergraph Substrate for Higher-Order Relational Reasoning

This crate provides a hypergraph-based substrate for representing and querying complex, higher-order relationships between entities. It extends beyond simple pairwise graphs to support hyperedges that span arbitrary sets of entities.

§Features

  • Hyperedge Support: Relations spanning multiple entities (not just pairs)
  • Topological Data Analysis: Persistent homology and Betti number computation
  • Sheaf Theory: Consistency checks for distributed data structures
  • Thread-Safe: Lock-free concurrent access using DashMap

§Example

use exo_hypergraph::{HypergraphSubstrate, HypergraphConfig};
use exo_core::{EntityId, Relation, RelationType};

let config = HypergraphConfig::default();
let mut hypergraph = HypergraphSubstrate::new(config);

// Create entities
let entity1 = EntityId::new();
let entity2 = EntityId::new();
let entity3 = EntityId::new();

// Add entities to the hypergraph
hypergraph.add_entity(entity1, serde_json::json!({"name": "Alice"}));
hypergraph.add_entity(entity2, serde_json::json!({"name": "Bob"}));
hypergraph.add_entity(entity3, serde_json::json!({"name": "Charlie"}));

// Create a 3-way hyperedge
let relation = Relation {
    relation_type: RelationType::new("collaboration"),
    properties: serde_json::json!({"weight": 0.9}),
};

let hyperedge_id = hypergraph.create_hyperedge(
    &[entity1, entity2, entity3],
    &relation
).unwrap();

Re-exports§

pub use hyperedge::Hyperedge;
pub use hyperedge::HyperedgeIndex;
pub use sheaf::SheafStructure;
pub use sheaf::SheafInconsistency;
pub use topology::SimplicialComplex;
pub use topology::PersistenceDiagram;

Modules§

hyperedge
Hyperedge structures and indexing
sheaf
Sheaf-theoretic structures for consistency checking
topology
Topological Data Analysis (TDA) structures

Structs§

HypergraphConfig
Configuration for hypergraph substrate
HypergraphStats
Statistics about the hypergraph
HypergraphSubstrate
Hypergraph substrate for higher-order relations