Additive diagram bridges (no merge) for diagram connectivity#53
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.precedingEventstill merges its own shared entities (the core mechanism); the diagram json never drives a merge.LNG_DIAGRAM_BRIDGEnow defaults on. Set it to0to restore the legacy merge augmentation; set bothLNG_DIAGRAM_BRIDGE=0andLNG_DIAGRAM_CONNECTIVITY=0to disable diagram connectivity entirely.A/B (Reactome v97, merge vs additive bridge)
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