Skip to main content
100%

Draggable Network II

✓ Published0🌍 Public
Mmbostock
Last edited Jun 6, 2017
Created on Jan 18, 2013

This interactive network visualization uses a force-directed layout to display a graph with 80 nodes and numerous links. Users can select individual nodes or drag a rectangular brush across the background to select multiple nodes, with the SHIFT key toggling additional selections. Once selected, nodes can be dragged to reposition, with connected links updating in real-time via the `d3.drag` and `d3.brush` APIs. Arrow keys also nudge selected nodes incrementally. The example demonstrates customizing a force-directed layout through manual adjustment, using the D3.js v4 library and rendering to SVG.

AI-generated description

This brushable and draggable network supports multiple selections via the SHIFT key. Click and drag the background area to make a rectangular selection (brushing). Once you’ve selected some nodes, drag them around to reposition the network. You might use this technique to hand-tweak a force-directed layout for better appearance, saving the manually-adjusted node positions back to a file.

For greater control, you can hold down the SHIFT key to add to or remove from an existing selection, either by creating a new rectangular selection or clicking on an individual nodes. You can use the OPTION and SPACE keys to modify the rectangular selection while dragging. You can also use the arrow keys to nudge selected nodes.

A further improvement to this example would be to allow rigid-body transformations of selected nodes (scale and rotate, in addition to translate). You might do this by checking for the META key while dragging. If the META key is down, you’d rotate and scale the nodes around the selected node’s centroid, rather than just translating. You might also try running a few iterations of the force layout on selected nodes interactively. Fork this example to implement these ideas yourself!

gpl-3.0 Licensed

Similar vizzes