Skip to content

Additive diagram bridges (no merge) for diagram connectivity#53

Merged
adamjohnwright merged 1 commit into
mainfrom
feature/additive-diagram-bridges
Jul 23, 2026
Merged

Additive diagram bridges (no merge) for diagram connectivity#53
adamjohnwright merged 1 commit into
mainfrom
feature/additive-diagram-bridges

Conversation

@adamjohnwright

Copy link
Copy Markdown
Contributor

Changes diagram-derived connectivity from merging shared entities to adding bridge edges — so the diagram json files only ever add connectivity, never merge or drop nodes/edges.

What changed

Previously, a diagram-drawn (producer, consumer) pair was folded in by union-find merging the shared entity's producer-output copy with the consumer-input copy — which removes a node and can dedup edges away. Now it emits an additive bridge edge producer.output-copy → consumer.input-copy (edge_type="diagram_bridge"), preserving every original node and edge. precedingEvent still merges its own shared entities (the core mechanism); the diagram json never drives a merge.

LNG_DIAGRAM_BRIDGE now defaults on. Set it to 0 to restore the legacy merge augmentation; set both LNG_DIAGRAM_BRIDGE=0 and LNG_DIAGRAM_CONNECTIVITY=0 to disable diagram connectivity entirely.

A/B (Reactome v97, merge vs additive bridge)

Merge (legacy) Bridge (additive)
curator accuracy 83.15% 83.20%
curator macro-F1 0.7943 0.7938
experimental accuracy 73.50% 73.62%
experimental macro-F1 0.6572 0.6582

Statistically neutral and marginally better. Notably, TP53 improves (+2 cases) because the additive form adds connectivity without the entity-destruction that made the earlier merge-based "descend" regress TP53. Verified on ERBB2: +306 edges, +133 nodes — nothing merged away.

Tradeoff: networks are larger (329k bridge edges catalog-wide); two very large pathways (Nucleotide Excision Repair, Class I MHC) exceed the benchmark's 100k-edge HTTP cap. Generation itself is unaffected.

Verification

Non-Neo4j suite passes (40 diagram/logic tests green). Full v97 regen + curator & experimental benchmarks run clean.

🤖 Generated with Claude Code

…connectivity

Diagram-drawn shared-entity connections were previously folded into the network
by MERGING the shared entity's two copies (producer output-copy unified with
consumer input-copy via union-find), which removes a node and can drop edges.
This adds them as NEW bridge edges instead — producer.output-copy -> consumer.
input-copy, edge_type="diagram_bridge" — so nothing is unified or lost; every
original node and edge is preserved and the diagram only ever ADDS connectivity.

- create_pathway_logic_network: new optional diagram_bridge_pairs; Phase 3b emits
  one additive edge per drawn shared entity, skipping pairs already connected via
  a precedingEvent merge (same canonical uuid).
- pathway_generator: LNG_DIAGRAM_BRIDGE now defaults ON. precedingEvent still
  merges its own shared entities (core mechanism); the diagram json never drives
  a merge. LNG_DIAGRAM_BRIDGE=0 restores the legacy merge augmentation.

Benchmark A/B (R97, merge vs bridge): statistically neutral and marginally
better — curator 83.15%->83.20%, experimental 73.50%->73.62% (TP53 +2 cases,
everything else flat). The additive form notably avoids the entity-destruction
that made the earlier merge-descend regress TP53. Verified on ERBB2: +306 edges,
+133 nodes (nothing merged away). Tradeoff: larger networks (2 very large
pathways exceed the benchmark's HTTP edge cap).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@adamjohnwright
adamjohnwright merged commit 7aca90d into main Jul 23, 2026
4 checks passed
@adamjohnwright
adamjohnwright deleted the feature/additive-diagram-bridges branch July 23, 2026 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant