Skip to content

1680: Order by Cluster Size in 2d network view - #1767

Open
glstott wants to merge 3 commits into
CDCgov:devfrom
glstott:1680-order_by_size
Open

1680: Order by Cluster Size in 2d network view#1767
glstott wants to merge 3 commits into
CDCgov:devfrom
glstott:1680-order_by_size

Conversation

@glstott

@glstott glstott commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Suggested title

Add cluster-size ordering to the 2D network view, addressing GI #1680

PR description

Summary

Adds a layout selector under 2D Network Settings → Network → Display with two options:

  • Force directed — retains the existing default behavior.
  • Order clusters by size — groups connected components by size and arranges them horizontally from smallest to largest.

The new layout:

  • Keeps each cluster’s internal structure intact.
  • Places equal-sized clusters together.
  • Accounts for visible nodes, links, and collapsed aggregate counts.
  • Fits the completed arrangement within the viewport.
  • Saves the original force-directed positions and restores them when switching back.
  • Persists the selected layout in session styling.

Testing

Added focused Cypress coverage that verifies:

  • Cluster-size bands increase from left to right.
  • Adjacent size bands do not overlap.
  • Nodes move when size ordering is selected.
  • Original positions are restored when returning to force-directed layout.

Also added a stress-test dataset containing:

  • 204 disconnected clusters
  • 5,675 nodes and 5,520 links
  • Four clusters of every size from 1–50
  • Outliers containing 75, 100, 150, and 250 nodes
  • Chain, star, cycle, and binary-tree topologies

The targeted Cypress layout test passed.

Performance note

There is no application-defined cluster limit. Chromium’s theoretical ceiling is approximately 123,700 rendered components due to JavaScript argument limits, although practical performance depends heavily on total nodes and links and becomes constrained much earlier.

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