HypergraphSubstrate

Struct HypergraphSubstrate 

Source
pub struct HypergraphSubstrate { /* private fields */ }
Expand description

Hypergraph substrate for higher-order relations

Provides a substrate for storing and querying hypergraphs, supporting:

  • Hyperedges spanning multiple entities
  • Topological data analysis (persistent homology, Betti numbers)
  • Sheaf-theoretic consistency checks

Implementations§

Source§

impl HypergraphSubstrate

Source

pub fn new(config: HypergraphConfig) -> Self

Create a new hypergraph substrate

Source

pub fn add_entity(&self, id: EntityId, metadata: Value)

Add an entity to the hypergraph

Source

pub fn contains_entity(&self, id: &EntityId) -> bool

Check if entity exists

Source

pub fn create_hyperedge( &mut self, entities: &[EntityId], relation: &Relation, ) -> Result<HyperedgeId, Error>

Create hyperedge spanning multiple entities

§Arguments
  • entities - Slice of entity IDs to connect
  • relation - Relation describing the connection
§Returns

The ID of the created hyperedge

§Errors

Returns Error::EntityNotFound if any entity doesn’t exist

Source

pub fn hyperedges_for_entity(&self, entity: &EntityId) -> Vec<HyperedgeId>

Query hyperedges containing a specific entity

Source

pub fn get_hyperedge(&self, id: &HyperedgeId) -> Option<Hyperedge>

Get hyperedge by ID

Source

pub fn persistent_homology( &self, dimension: usize, epsilon_range: (f32, f32), ) -> PersistenceDiagram

Topological query: find persistent features

Computes persistent homology features in the specified dimension over the given epsilon range.

Source

pub fn betti_numbers(&self, max_dim: usize) -> Vec<usize>

Query Betti numbers (topological invariants)

Returns the Betti numbers up to max_dim, where:

  • β₀ = number of connected components
  • β₁ = number of 1-dimensional holes (loops)
  • β₂ = number of 2-dimensional holes (voids)
  • etc.
Source

pub fn check_sheaf_consistency( &self, sections: &[SectionId], ) -> SheafConsistencyResult

Sheaf consistency: check local-to-global coherence

Checks if local sections are consistent on their overlaps, following the sheaf axioms.

Source

pub fn query(&self, query: &TopologicalQuery) -> Result<HyperedgeResult, Error>

Execute a topological query

Source

pub fn stats(&self) -> HypergraphStats

Get statistics about the hypergraph

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.