Skip to content

Commit c3c4c0f

Browse files
fix: diagram improvements for collapse and display
- Disambiguate cluster labels when multiple schemas share same module name (e.g., all defined in __main__) - adds schema name to label - Fix Computed node shape to use same size as Imported (ellipse, not small circle) - Merge nodes, edges, and contexts when combining diagrams from different schemas Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 3292a06 commit c3c4c0f

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/datajoint/diagram.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,17 @@ def make_dot(self):
591591
else:
592592
cluster_labels[schema_name] = schema_name
593593

594+
# Disambiguate labels if multiple schemas share the same module name
595+
# (e.g., all defined in __main__ in a notebook)
596+
label_counts = {}
597+
for label in cluster_labels.values():
598+
label_counts[label] = label_counts.get(label, 0) + 1
599+
600+
for schema_name, label in cluster_labels.items():
601+
if label_counts[label] > 1:
602+
# Multiple schemas share this module name - add schema name
603+
cluster_labels[schema_name] = f"{label} ({schema_name})"
604+
594605
# Assign alias nodes (orange dots) to the same schema as their child table
595606
for node, data in graph.nodes(data=True):
596607
if data.get("node_type") is _AliasNode:
@@ -638,8 +649,8 @@ def make_dot(self):
638649
color="#FF000020",
639650
fontcolor="#7F0000A0",
640651
fontsize=round(scale * 10),
641-
size=0.3 * scale,
642-
fixed=True,
652+
size=0.4 * scale,
653+
fixed=False,
643654
),
644655
Imported: dict(
645656
shape="ellipse",

0 commit comments

Comments
 (0)