From 3a117c93e8120adc2c65d646b7f8ee92f99b02ad Mon Sep 17 00:00:00 2001 From: Safi Date: Sun, 5 Apr 2026 23:18:25 +0100 Subject: [PATCH] v2: hypergraph support - hyperedges in graph.json, shaded regions in HTML, report section --- graphify/build.py | 3 + graphify/export.py | 66 +++++++++++++ graphify/report.py | 10 ++ graphify/skill.md | 8 +- pyproject.toml | 2 +- skills/graphify/skill.md | 8 +- tests/test_hypergraph.py | 205 +++++++++++++++++++++++++++++++++++++++ 7 files changed, 299 insertions(+), 3 deletions(-) create mode 100644 tests/test_hypergraph.py diff --git a/graphify/build.py b/graphify/build.py index 655820c0..0975d7a5 100644 --- a/graphify/build.py +++ b/graphify/build.py @@ -25,6 +25,9 @@ def build_from_json(extraction: dict) -> nx.Graph: attrs["_src"] = src attrs["_tgt"] = tgt G.add_edge(src, tgt, **attrs) + hyperedges = extraction.get("hyperedges", []) + if hyperedges: + G.graph["hyperedges"] = hyperedges return G diff --git a/graphify/export.py b/graphify/export.py index e733221d..92991793 100644 --- a/graphify/export.py +++ b/graphify/export.py @@ -55,6 +55,58 @@ def _html_styles() -> str: """ +def _hyperedge_script(hyperedges_json: str) -> str: + return f"""""" + + def _html_script(nodes_json: str, edges_json: str, legend_json: str) -> str: return f"""