Skip to content

Visualizer compaction and optimization - #85

Merged
harsh-sikhwal merged 5 commits into
mainfrom
visualizer-compaction-and-optimization
Sep 23, 2026
Merged

harsh-sikhwal merged 5 commits into
mainfrom
visualizer-compaction-and-optimization

Conversation

@Amos-Rai-KEYS

Copy link
Copy Markdown
Collaborator

PR Summary: Visualizer Compaction and Performance Optimization

Overview

Adds large-fabric support to the infrastructure visualizer: server-side layout precomputation, a compressed-view ladder for large topologies, on-demand "rack/pod" drill-down views, and rendering optimizations for large graphs. Also includes a couple of small fixes and README cleanup.

Key changes

1. Precomputed layout (visualize.py)

  • New Visualizer._compute_layout assigns hierarchical level + x/y position to every instance node server-side (BFS from hosts + barycenter ordering), so the browser no longer needs to run vis.js's hierarchical layout/physics engine to open large graphs.
  • Edges now carry a count (parallel-link count) alongside the existing label/width.

2. Compressed view ladder (visualize.py, navigation.js)

  • For fabrics with more than 128 hosts (COMPRESS_MIN_HOSTS), _generate_compressed_views builds a ladder of infrastructure_compressed_N.json views, each merging nodes with identical connectivity one step further than the last, ending in one node per tier.
  • Groups are semantically labeled from data: a bottom-tier group whose members all uplink to one switch → rack; several racks merged → pod; everything else → group.
  • Frontend adds a Compressed toggle button + slider in the header (navigation.js) to switch the infrastructure view to a chosen rung, only enabled/visible when on the top-level infrastructure view.

3. Rack/pod drill-down (navigation.js, data.js, app.js)

  • Clicking a rack/pod group node (instead of a switch group) opens a synthesized "rack view": the group's real member servers plus switches they uplink to, built on demand from infrastructure.json and laid out client-side (layoutSubgraph, a JS port of the Python layout).
  • A hop slider controls how much surrounding fabric is included; capped at 250 nodes (RACK_MAX_NODES) to stay responsive, with a toast shown when capped or refused.
  • Groups too large to open (highest compression rungs) show a "not-allowed" cursor and toast instead of silently doing nothing.

4. Large-graph rendering mode (network.js, data.js, app.js)

  • Graphs ≥300 nodes or ≥1000 edges automatically switch to a simplified rendering mode: no text stroke/shadow, straight (non-bezier) edges, hover effects disabled — these are the slowest canvas primitives on pan/zoom.
  • Manual override checkbox in the controls panel; optionsForData() centralizes picking precomputed vs. hierarchical vs. large-graph vis.js options.

5. Misc frontend fixes

  • controller.js: slider handlers (font/node size, spacing) are now debounced (120ms) instead of firing on every pixel of drag; precomputed-view spacing sliders rescale positions directly instead of re-running vis layout.
  • app.js / render(): uses a Map lookup (nodeById) instead of Array.find for click/hover node lookup; skips the stabilizationIterationsDone physics dance entirely when a view has no physics.
  • search.js: node search result colors now use CSS theme variables instead of hardcoded hex, so results respect dark/light theme.
  • visualize.py: removes two now-unnecessary lines from the pipeline (pipeline fix commit).

6. Docs

  • README.md / docs/src/cli.md: document the compressed view, rack/pod behavior, and --hosts guidance.
  • Removes src/infragraph/visualizer/README.md (407 lines) and a couple of lines from the root README in the final commit — worth confirming this was an intentional retirement of that file rather than an accidental deletion, since there's no equivalent content added elsewhere in the diff.

Files touched

visualize.py, navigation.js (+341 new), network.js (+42 new), data.js, app.js, controller.js, filters.js, search.js, style.css, index.html, README.md, docs/src/cli.md.

@harsh-sikhwal
harsh-sikhwal merged commit 92a481c into main Sep 23, 2026
1 check passed
@harsh-sikhwal
harsh-sikhwal deleted the visualizer-compaction-and-optimization branch September 23, 2026 14:35
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.

3 participants