Repository navigation
Conversation
There was a problem hiding this comment.
Thanks @tygvi, passing num_nodes=mesh_pos.shape[0] to pyg.utils.degree makes sense. Just noticed one small thing in CHANGELOG.md: the link URL still has /pull/XXX instead of /pull/884, which will fail the lychee check once CI runs.
|
Fixed the CHANGELOG link now points to /pull/884 and lychee passes locally. Ready for re-review. |
|
Had a look, @tygvi. The fix is the right one and matches how create_graph.py:62 already calls degree with num_nodes. I ran the new test on unmodified main and all three parametrisations fail with the concatenate ValueError, then pass on this branch. A fully empty m2m_edge_index of shape (2, 0) and an unconnected node in the middle of the index range also work now. One small thing: an unconnected node now gets the right z, but its marker size is mesh_degrees / 2 = 0 (plot_graph.py:154), so I don't think it actually shows up in the figure, which makes it hard to spot the node someone is probably debugging. A small floor like np.maximum(mesh_degrees / 2, 0.5), or asserting on fig.data[-1].marker.size in the test, would cover that. Fine as a follow-up if you'd rather keep this minimal. |
|
Thanks @nikhil3495 — good catch, you're right that the node was in the data but not actually visible. I've floored the marker size in mesh_node_size = np.maximum(mesh_degrees / 2, 0.5)so an unconnected node now renders as a small dot instead of collapsing to size 0. I also extended Pushed in 79195e3. Ready for re-review when you get a chance. |
Describe your changes
plot_graphinferred the mesh node count frompyg.utils.degree(m2m_edge_index[1]), which returnsmax(index) + 1entries. A mesh node with nom2medge was therefore missing fromz_meshand thenp.concatenateadding the z column raisedValueError, aborting the figure.Passing
num_nodes=mesh_pos.shape[0]uses the mesh node count frommesh_features.ptinstead. An unconnected node now gets degree 0 and is drawn at the base mesh height. Same direction as #740 for #729; the graph storage spec §3.1.1 permits indices with no edges.Tests
pytest tests/test_plot_graph.py tests/test_plotting.py -q→ 36 passed.test_mesh_node_without_m2m_edges(parametrised 2/3/5 nodes) fails onmainwith theValueErrorabove and passes with the fix.ruff check/ruff format --checkon the two changed files: clean.pre-commit(lycheeneeds network), full suite, GPU tests, and the CLI against real data (example data unavailable here).Issue Link
Closes #883
Type of change
Checklist before requesting a review
pullwith--rebaseoption if possible).Checklist for reviewers
Each PR comes with its own improvements and flaws. The reviewer should check the following:
Author checklist after completed review
Checklist for assignee