Skip to content

Fix backward_step node removal to clean up incident edges#500

Draft
josephdviviano wants to merge 1 commit intomasterfrom
fix-backward-node-removal
Draft

Fix backward_step node removal to clean up incident edges#500
josephdviviano wants to merge 1 commit intomasterfrom
fix-backward-node-removal

Conversation

@josephdviviano
Copy link
Copy Markdown
Collaborator

Summary

  • When backward-stepping a node removal in GraphBuilding, edges incident to the deleted node must be removed before re-indexing
  • Previously the code asserted no such edges existed (assert torch.all(graph.edge_index != node_idx)), crashing if the graph had edges touching the removed node
  • Now edges are properly filtered out and edge_attr is cleaned up alongside edge_index
  • Cherry-picked from the fix-graph2 branch with an additional edge_attr fix

Test plan

  • test_graph_env passes
  • Full test suite passes (1511 tests)

🤖 Generated with Claude Code

When backward-stepping a node removal, edges incident to the deleted
node must be removed before re-indexing. Previously the code asserted
no such edges existed, which would crash if the graph had edges
touching the removed node. Now edges are properly filtered out and
edge_attr is cleaned up alongside edge_index.

Also makes test_graph_env node class assignment deterministic.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 24, 2026

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 72.48%. Comparing base (f0605a8) to head (342dce6).

Files with missing lines Patch % Lines
src/gfn/gym/graph_building.py 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #500      +/-   ##
==========================================
- Coverage   72.48%   72.48%   -0.01%     
==========================================
  Files          55       55              
  Lines        8519     8522       +3     
  Branches     1090     1091       +1     
==========================================
+ Hits         6175     6177       +2     
  Misses       1957     1957              
- Partials      387      388       +1     
Files with missing lines Coverage Δ
src/gfn/gym/graph_building.py 81.90% <75.00%> (-0.21%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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