Erdős–Rényi Force Directed Graph
This visualization shows an Erdős–Rényi random graph, where nodes are placed along an Archimedean spiral and edges appear based on a user-controlled probability. Red nodes are those with no connections, and the number on each node displays its degree. Built with D3 v2’s force layout, the example uses SVG text and lines for rendering, with a dat.GUI panel to adjust node count, link probability, and force parameters like charge and gravity. A mousewheel zoom control also changes the node count dynamically.
AI-generated descriptionCreated by Christopher Manning
Summary
This creates a graph with the number of nodes you specify and random edges based on the probability selected. The number indicates how many edges are connected to that node. Red nodes are not connected to any other nodes.
Inspired by this tweet from @ChicagoCDO
Nodes are added to the graph along the path of an Archimedean spiral. This is more pleasing than adding nodes at random locations. This also prevents new nodes from chaotically bouncing around since now they are always placed at a reasonable distance from each other.
Controls
- Use the mousewheel to increase or decrease the number of nodes.
References
forked from <a href='http://bl.ocks.org/christophermanning/'>christophermanning</a>'s block: <a href='http://bl.ocks.org/christophermanning/4187201'>Erdős–Rényi Force Directed Graph</a>