Skip to content

Release the graph held by the layouts at the end, and write the OpenOrd positions through its own nodes - #3366

Merged
mbastian merged 7 commits into
masterfrom
fix/release-destroyed-view-holders
Oct 29, 2026
Merged

mbastian merged 7 commits into
masterfrom
fix/release-destroyed-view-holders

Conversation

@mbastian

@mbastian mbastian commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

Description

Companion to gephi/graphstore#364, which makes the most recently destroyed views keep following the graph store for as long as a graph of them is held (this replaces #3363, which re-fetched the visible graph in each layout). A destroyed view that is held costs about as much as a live one on every change of the store, so the layouts should not keep one for no reason.

  • The layouts keep the graph of their last run in a field, which may be the graph of a view that a filter has destroyed since. endAlgo now releases it, after the layout data is cleaned up (ForceAtlas, Fruchterman-Reingold, Noverlap, Label Adjust and Yifan Hu; ForceAtlas2 and Random already do it). ForceAtlas, Fruchterman-Reingold, Label Adjust and Yifan Hu only get their graph in goAlgo or initAlgo, so their endAlgo returns early if a run was stopped before it.
  • Yifan Hu's Reset used the graph field to know if the layout ran before (it computes the optimal distance from the visible graph, and sets 100 otherwise), so it uses a ranOnce flag now that the graph is released.
  • OpenOrd no longer keeps a graph, nor any field in its place. Its workers write the positions every iteration, and they did it through the held graph: once the view of that graph had been destroyed more than 8 times (a few hundred milliseconds of timeline play, or one pass of a large query), the graph was emptied and the positions were never written again. Combine now writes through the node array captured at init, where the node id is the index, and uses the workers of its own run, so the last combine of a stopped run still writes its positions, as before, and never mixes them with the next run. Nodes that left the view meanwhile are written too, which is harmless. This removes the public OpenOrdLayout.getGraph() and changes the Combine constructor, which nothing outside OpenOrd used, and the OpenOrdLayoutData is no longer set on the nodes, as nothing reads it.

Checklist

  • Merged with master beforehand

Added tests?

  • 👍 yes
  • 🙅 no, because they aren't needed

Added to documentation?

  • 👍 README.md
  • 👍 API Changes
  • 👍 Additional documentation in docs
  • 👍 Relevant code documentation
  • 🙅 no, because they aren’t needed

🤖 Generated with Claude Code

…orceAtlas2 pass

The layouts kept the graph of their last run in a field, which may be the graph of a view the filter has since destroyed. Each one keeps the destroyed view updated by the graph store for as long as it is held, so it is released in `endAlgo` once the layout data is cleaned up. ForceAtlas, Fruchterman-Reingold and Label Adjust only get their graph in `goAlgo`, so their `endAlgo` returns early if a run was stopped before it. OpenOrd's workers can still combine once after `endAlgo`, which no longer writes the positions then.

ForceAtlas2 also skips the pass when no node moves, as the speed was NaN for good after 0 / 0, whether the graph is empty or all the nodes are fixed or at rest.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@mbastian
mbastian requested a review from a team as a code owner October 25, 2026 19:35
mbastian and others added 3 commits October 25, 2026 20:38
The held graph may be emptied once the filter has destroyed its view more than 8 times, after which the positions were never written again. The node array captured at init has no such dependency, and the node id is the index.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
mbastian and others added 2 commits October 26, 2026 21:32
Reset computed the optimal distance from the graph of the last run, whose view may have been destroyed and emptied since. The average edge length was then 0, which left the step at 0, and Yifan Hu never moved a node again. Reset now reads the visible graph under the read lock, taken before the fetch, so endAlgo can release the graph like the other layouts. Before any run, Reset still sets 100.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A stopped run still combines once more. When the next run on the same layout had already started, that combine read the next run's workers and node array from the layout, and could mix them with its own, writing wrong positions or failing on an out-of-bounds index. Combine now gets the workers and the node array of its run, so the last combine of a stopped run writes its positions to its own nodes, as before the graph was released. The OpenOrdLayoutData set on every node was only read by the old combine and is no longer set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mbastian mbastian changed the title Release the graph held by the layouts at the end, and skip the idle ForceAtlas2 pass Release the graph held by the layouts at the end, and write the OpenOrd positions through its own nodes Oct 29, 2026
@mbastian mbastian added the Sustainability Core improvements to improve reliability or maintenance label Oct 29, 2026
@mbastian mbastian added this to the 0.11.4 milestone Oct 29, 2026
@mbastian
mbastian merged commit 8b860a2 into master Oct 29, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Sustainability Core improvements to improve reliability or maintenance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant