1.0 KiB
1.0 KiB
Architecture: hyper-p2p-graph-index
Category: indexes-search
Protocol: graph-index/v1 (local-only)
Purpose
In-memory directed/undirected graph with BFS traversal for peer graphs, capability graphs, or workflow dependencies.
Storage model
_adj: Map<nodeId, Set<neighborId>>
Undirected edges are stored as two directed entries when directed: false.
Wire messages
| type | fields | behavior |
|---|---|---|
| — | — | No network layer |
BFS algorithm
frontier = [start], visited = {start}
for d in 0..maxDepth-1:
expand frontier via neighbors(node)
skip visited, append to order/layers
Lifecycle
Construct → addEdge / bfs / removeNode → close.
Composition
../../_shared/lib/errors.jsfor validation- Combine with
hyper-p2p-geo-hint-routeror app routers for spatial/logical routing; this module does not pick peers
Limits
- No edge weights, no persistence, no distributed merge
removeNodedoes not decrementstats.edges