Skip to content

Circular Layout 0.9.4: don't give NaN positions to nodes without size - #361

Merged
mbastian merged 1 commit into
master-forgefrom
fix/circular-layout-nan
Nov 8, 2026
Merged

mbastian merged 1 commit into
master-forgefrom
fix/circular-layout-nan

Conversation

@mbastian

@mbastian mbastian commented Nov 8, 2026

Copy link
Copy Markdown
Member

Found by the SPI contract tests of gephi-plugins-tests (LayoutContractTest), run against Gephi 0.11.4.

The three layouts (Circle, Dual Circle, Radial Axis) space nodes by their size. When all nodes have size 0, e.g. a graph of nodes ranked down to zero, or a single such node, the circumference is 0 and the angle 2π / 0 is Infinity. Infinity × 0 then gives NaN positions, and graphstore throws x cannot be NaN from goAlgo().

  • Added LayoutHelper.nodeSize(Node), a node's size with a minimum of 1, and used it in place of n.size() for the circumference and angle computations (9 places in the three layouts).
  • Nodes of size 1 or more behave exactly as before.
  • Version 0.9.3 → 0.9.4.

Verified: the layout contract tests (gephi-plugins-tests 1.1.1) pass on this module, which failed 5 of them before. Short-lived branch off master-forge, so the diff is only these files.

The layouts space nodes by their size, so a graph whose nodes all have size 0 (or a single such node) made the circumference 0 and the angle Infinity, giving NaN positions that graphstore rejects. Use a minimum size of 1 in the circumference and angle computations. Version 0.9.4.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@mbastian
mbastian merged commit e5d750a into master-forge Nov 8, 2026
2 checks passed
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