oneshotlm
Compare all models on this prompt →

Force-directed graph · kat-coder-pro-v2

Output generated Cost / run $0.0078 Runtime 61.5s

Prompt for this run

Using the pre-provided d3.min.js (global d3), render an interactive force-directed graph of about 40 nodes in several clusters with draggable nodes, hover highlighting of neighbors, and zoom/pan. Define the sample nodes and links inline.

⛨ sandboxed Open in new tab ↗

TAKE IT TO CODE

A single self-contained HTML file — copy it and open in any browser, or reuse the prompt with your own pi-agent run.

RUN

modelkat-coder-pro-v2
vendorKwaipilot
harnesspi-agent
generated2026-07-31

METRICS

runtime61.5s
tokens in8.0k
tokens out4.5k
cached0
cost / run$0.0078
Transcript · 4 messages
user

Using the pre-provided d3.min.js (global d3), render an interactive force-directed graph of about 40 nodes in several clusters with draggable nodes, hover highlighting of neighbors, and zoom/pan. Define the sample nodes and links inline.

assistant

I'll create an interactive force-directed graph visualization using D3.js with all the requested features. Let me build this step by step.

→ write /workspace/index.html (15659 bytes)
toolResult

Successfully wrote 15659 bytes to /workspace/index.html

assistant

Perfect! I've created an interactive force-directed graph visualization in `/workspace/index.html`. Here's what's included: ## Features: - **40 nodes** organized into 5 colored clusters (Technology, Science, Arts, Business, Sports) - **70 links** with preferential attachment within clusters - **Draggable nodes** - click and drag to reposition - **Hover highlighting** - hover over nodes to see neighbors and connection info - **Zoom & pan** - mouse wheel to zoom, drag empty space to pan - **Interactive controls**: - Charge strength slider (repulsion between nodes) - Link distance slider (spacing between connected nodes) - Restart simulation button - Reset zoom button - Toggle labels button - **Tooltips** showing node details on hover - **Legend** showing cluster colors - **Zoom indicator** showing current zoom level The graph uses D3's force simulation with collision detection to create natural-looking clusters. Nodes are sized based on random values, and links have varying thickness based on connection strength. Open `index.html` in your browser to see the interactive visualization!