From 42b39197a6efda9e50ed3f4419407cba8a29934d Mon Sep 17 00:00:00 2001 From: tomsmith8 Date: Thu, 9 Apr 2026 12:30:19 +0000 Subject: [PATCH] Generated with Hive: Reverse CHILD_OF edge direction in dagre layout to render Thing at top --- src/app/ontology/ontology-graph.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app/ontology/ontology-graph.tsx b/src/app/ontology/ontology-graph.tsx index 2a83a50..2fc20ac 100644 --- a/src/app/ontology/ontology-graph.tsx +++ b/src/app/ontology/ontology-graph.tsx @@ -35,10 +35,15 @@ function buildLayout(schemas: SchemaNode[], edges: SchemaEdge[]) { g.setNode(s.ref_id, { width: NODE_WIDTH, height: NODE_HEIGHT }) } - // Add all edges — CHILD_OF edges form the hierarchy, rest are relationships + // Add all edges — CHILD_OF edges are reversed so dagre places parent (Thing) at top for (const e of edges) { if (g.hasNode(e.source) && g.hasNode(e.target)) { - g.setEdge(e.source, e.target, { label: e.edge_type }) + if (e.edge_type === "CHILD_OF") { + // Reverse: dagre sees parent→child so parent ranks higher (top) + g.setEdge(e.target, e.source, { label: e.edge_type }) + } else { + g.setEdge(e.source, e.target, { label: e.edge_type }) + } } }