babylon.engine.graph_wrappers
Typed graph wrappers for Spec 040 Discipline 5.
Enforces separation between dyadic edges (BabylonGraph) and hyperedges (XGI Hypergraph). Systems access graph topology through these typed wrappers, not raw data structures.
DyadicGraph: Wraps BabylonGraph for pairwise (source → target) edges. CommunityHypergraph: Wraps xgi.Hypergraph for n-ary community membership.
Classes
|
Typed wrapper for XGI Hypergraph (n-ary community membership). |
|
Typed wrapper for BabylonGraph (pairwise edges). |
- class babylon.engine.graph_wrappers.DyadicGraph(graph)[source]
Bases:
objectTyped wrapper for BabylonGraph (pairwise edges).
Provides typed edge operations that enforce EdgeType on all edge queries and mutations.
- Parameters:
graph (BabylonGraph)
- raw
The underlying BabylonGraph.
- __init__(graph)[source]
Wrap a BabylonGraph.
- Parameters:
graph (
BabylonGraph) – The directed world graph.- Return type:
None
- property raw: BabylonGraph
Access the underlying raw graph.
- class babylon.engine.graph_wrappers.CommunityHypergraph(hypergraph=None)[source]
Bases:
objectTyped wrapper for XGI Hypergraph (n-ary community membership).
Provides typed community operations for adding communities, querying membership, and computing overlap.
- Parameters:
hypergraph (xgi.Hypergraph | None)
- __init__(hypergraph=None)[source]
Initialize with an optional existing hypergraph.
- Parameters:
hypergraph (
Hypergraph|None) – Existing XGI Hypergraph, or None for empty.- Return type:
None
- property raw: Hypergraph
Access the underlying raw hypergraph.
Find communities shared by two agents.