Concepts
Hypergraph
Understanding hypergraphs and why they matter for AI memory
Hypergraph
HyperMemory stores your agent’s knowledge in a hypergraph — a data structure that captures relationships more naturally than traditional graphs.
Graphs you already know
A regular graph has nodes connected by edges, where each edge connects exactly two nodes.
Alice ────manages────► Project Alpha
│ │
│ ─────┘
└───collaborates───► Bob
This works for simple relationships, but real-world knowledge is messier.
What makes a hypergraph different
In a hypergraph, a single edge — called a hyperedge — can connect three or more nodes simultaneously.
┌─────────────────────────────────────────────┐
│ Sprint Planning │
│ (hyperedge) │
│ │
│ Alice ─── Project Alpha ─── Sprint 12 │
│ │ │ │ │
│ └───────────┴──────────────┘ │
└─────────────────────────────────────────────┘
This single hyperedge captures that Alice, Project Alpha, and Sprint 12 are all connected through “Sprint Planning” — without needing to create six separate binary edges.
Why this matters for AI memory
Real-world knowledge rarely fits into neat pairs:
- Decisions involve multiple people, options, and outcomes
- Events connect participants, locations, times, and topics
- Projects span teams, milestones, dependencies, and stakeholders
With binary edges, your agent has to reconstruct complex contexts by traversing many connections. With hyperedges, the context is already captured in one relationship.
Example: Remembering a decision
Binary graph approach:
Decision ──involves──► Sarah
Decision ──involves──► Marcus
Decision ──concerns──► API v2
Decision ──occurred_at──► Q3 Planning
Decision ──outcome──► Approved
5 edges. Your agent has to traverse all of them to understand the full context.
Hypergraph approach:
[Sarah, Marcus, API v2, Q3 Planning, Approved]
↑
decision_context
1 hyperedge. The full context is captured atomically.
HyperMemory’s data model
| Structure | Description |
|---|---|
| Nodes | Keyed entities with key, description, data, and node_type |
Edges (relates_to) | Directed binary relationships between two nodes with a natural-language label |
| Hyperedges | N-ary relationships connecting 3+ nodes via hyperedge + participates_in records |
| Ontology | Auto-managed catalog of types (onto_type) and relationships (onto_rel) |
When to use edges vs hyperedges
| Use Case | Recommendation |
|---|---|
| Simple relationship (A manages B) | Edge |
| Category membership (A is-a type) | Edge |
| Sequential connection (A then B) | Edge |
| Complex context (meeting with 5 participants) | Hyperedge |
| Decision involving multiple factors | Hyperedge |
| Event with multiple participants/outcomes | Hyperedge |
You don’t always need to decide upfront. The server’s enrichment pipeline automatically creates edges and hyperedges from stored descriptions when appropriate.