How wolframinstitute/hypergraphrewritingengine works
Hypergraph Rewriting Engine evolves a user-supplied initial hypergraph under rewrite rules, producing states, events, and causal/branchial relations. The main CPU workflow is exposed through the Mathematica FFI and driven by the parallel evolution engine, which coordinates matching and rewriting against shared hypergraph state. Canonicalization and quotient reconstruction support is represented alongside the core workflow; CUDA and paclet analyses are documented capabilities whose detailed implementation was not sampled. Arrows are limited to relationships shown by excerpts, the source index, or README; unsampled integration details are omitted.
Main entry points: hypergraph_ffi.cpp LibraryLink FFI · parallel_evolution.hpp Parallel evolution · cpu_engine_holder.hpp CPU engine holder · pattern_matcher.hpp Pattern matching
Components 16
User interface
- LibraryLink FFI
paclet_source/hypergraph_ffi.cpp - Session management
paclet_source/session.hpp - CPU engine holder
paclet_source/cpu_engine_holder.hpp - Graph marshalling
paclet_source/graph_marshal.hpp - WXF serialization
wxf/wxf.cpp
Evolution engine
- Parallel evolution
hypergraph/include/hypergraph/parallel_evolution.hpp - Pattern matching
hypergraph/include/hypergraph/pattern_matcher.hpp - Rewrite rules
hypergraph/include/hypergraph/pattern.hpp - Match rewriting
hypergraph/include/hypergraph/rewriter.hpp
State and analysis
- Hypergraph state
hypergraph/include/hypergraph/hypergraph.hpp - Exact canonicalization
common/include/hgcommon/ir_core.hpp - Causal and branchial data
hypergraph/include/hypergraph/causal_graph.hpp - Quotient reconstruction
common/include/hgcommon/quotient_replay_core.hpp
Accelerated execution
- CUDA backend
paclet_source/hg_gpu_backend.cpp - CUDA evolution state
gpu/include/hg_gpu/engine_state.hpp
Other components
- Mathematica caller
Connections 16
- Mathematica caller → LibraryLink FFI: invokes
README.md - LibraryLink FFI → CPU engine holder: creates CPU engine
paclet_source/cpu_engine_holder.hpp - LibraryLink FFI → Session management: manages sessions
paclet_source/session.hpp - CPU engine holder → Parallel evolution: drives evolution
paclet_source/cpu_engine_holder.hpp - Parallel evolution → Pattern matching: dispatches matches
hypergraph/include/hypergraph/parallel_evolution.hpp - Parallel evolution → Match rewriting: dispatches rewrites
hypergraph/include/hypergraph/parallel_evolution.hpp - Pattern matching → Rewrite rules: matches patterns
- Match rewriting → Rewrite rules: applies rules
- Parallel evolution → Hypergraph state: updates state
hypergraph/include/hypergraph/parallel_evolution.hpp - Hypergraph state → Exact canonicalization: computes canonical hash
hypergraph/src/hypergraph.cpp - Parallel evolution → Causal and branchial data: builds relations
README.md - Parallel evolution → Quotient reconstruction: reconstructs quotient
README.md - LibraryLink FFI → CUDA backend: selects GPU backend
- CUDA backend → CUDA evolution state: uses device state
- LibraryLink FFI → Graph marshalling: marshals results
- LibraryLink FFI → WXF serialization: serializes data