Directed Graph Editor
This interactive editor demonstrates force-directed graph editing with D3 v3’s `d3.layout.force`, rendering nodes and edges as SVG elements. Users can add nodes by clicking empty space and create edges by dragging between nodes, while keyboard shortcuts toggle edge direction (left/right/both), node reflexivity, and delete selections. The code uses `marker-start` and `marker-end` SVG markers to draw directed arrows, and `circle` styling plus `stroke-dasharray` to indicate selected nodes and edges. Node positions update continuously via the force simulation’s `tick` event, with color assignment from `d3.scale.category10`.
AI-generated descriptionClick in the open space to add a node, drag from one node to another to add an edge.
Ctrl-drag a node to move the graph layout.
Click a node or an edge to select it.
When a node is selected: R toggles reflexivity, Delete removes the node.
When an edge is selected: L(eft), R(ight), B(oth) change direction, Delete removes the edge.
To see this example as part of a larger project, check out Modal Logic Playground!
forked from <a href='http://bl.ocks.org/meetamit/'>meetamit</a>'s block: <a href='http://bl.ocks.org/meetamit/e63d04bd79d929f9cbaf'></a>