Network Science
Three landmark network models — Erdős–Rényi random, Barabási–Albert scale-free, Watts–Strogatz small-world — with force-directed layout and degree-distribution histogram
Nodes N 60
ER — prob p 0.08
60
Nodes
0
Edges
0.0
Avg Degree
0.00
Clustering C
0
Giant Comp.
0
Max Degree
Erdős–Rényi G(N,p): Each pair of nodes connected with probability p. Giant component emerges near p_c = 1/N. Degree follows Binomial → Poisson.   Barabási–Albert: Preferential attachment — new nodes link to m existing nodes with probability ∝ degree. Creates hubs with power-law degree distribution P(k) ∝ k⁻³.   Watts–Strogatz: Start with ring lattice (k neighbours each), rewire each edge with probability β. Low β → high clustering; high β → short average path length — the small-world regime.   Right panel shows the degree histogram (log scale). Node size ∝ degree.

About Network Science

This simulation generates and visualises three landmark models of complex networks: the Erdős–Rényi random graph G(N,p), the Barabási–Albert scale-free model and the Watts–Strogatz small-world model. A force-directed layout positions the nodes using repulsion between every pair, spring attraction along each edge and a gentle pull towards the centre, while breadth-first search identifies connected components and a clustering coefficient is computed for each node.

Sliders set the node count N (10–120) and a model-specific parameter: the edge probability p for Erdős–Rényi, the attachment edges m for Barabási–Albert, and the lattice degree k plus rewiring probability β for Watts–Strogatz. The right panel plots the degree distribution as a histogram. These models underpin the study of real systems such as social networks, the World Wide Web, power grids and the spread of epidemics, where structure shapes robustness and reach.

Frequently Asked Questions

What is network science?

Network science studies systems represented as nodes (vertices) joined by links (edges), from social ties to neural connections. It looks for universal structural patterns — hubs, clustering, short path lengths — that govern how a network behaves. This page lets you build and compare three classic generative models that capture different real-world structures.

What do the three model buttons do?

Each button switches the generator and reveals the parameters relevant to that model. Erdős–Rényi connects every pair of nodes independently with probability p; Barabási–Albert grows the network by preferential attachment; Watts–Strogatz starts from a ring lattice and randomly rewires edges. The statistics and histogram update so you can directly contrast the outcomes.

What do the controls and sliders change?

The Nodes N slider sets the network size from 10 to 120. The model-specific slider then sets the key parameter: probability p (0.01–0.4) for Erdős–Rényi, edges m (1–6) for Barabási–Albert, or lattice degree k (2–10) and rewiring β (0–1) for Watts–Strogatz. New Graph regenerates with fresh randomness, and Pause Layout freezes the physics so you can read the structure.

How does the Erdős–Rényi G(N,p) model work?

For every one of the N(N−1)/2 possible node pairs, an edge is added independently with probability p. The degree distribution is binomial and approaches a Poisson distribution for large N. A giant connected component emerges abruptly near the critical probability p_c = 1/N, which is why small changes in p can transform a fragmented graph into a single connected cluster.

What makes the Barabási–Albert model scale-free?

The network grows one node at a time, and each new node attaches to m existing nodes with probability proportional to their current degree — "the rich get richer". This preferential attachment produces a power-law degree distribution, P(k) ∝ k⁻³, meaning a few highly connected hubs coexist with many sparsely connected nodes. Node size on the canvas scales with degree, so hubs stand out clearly.

What is the small-world effect in the Watts–Strogatz model?

Starting from a ring lattice where each node links to its k nearest neighbours, every edge is rewired to a random target with probability β. At low β the network keeps high local clustering; introducing just a few long-range shortcuts sharply reduces the average path length while clustering stays high. This combination — short paths plus high clustering — is the defining small-world property.

What do the statistics boxes mean?

The panel reports the node and edge counts, the average degree (2E/N), the average clustering coefficient C, the size of the giant (largest connected) component, and the maximum degree. The clustering coefficient measures how often a node's neighbours are also connected to each other, averaged over all nodes, giving a single number for local cohesion.

How is the layout positioned on screen?

A force-directed algorithm treats nodes like charged particles that repel one another, with edges acting as springs that pull connected nodes together towards a rest length of about 60 pixels. A weak central gravity keeps everything on screen, and velocities are damped each frame for stability. You can drag any node, and pausing the layout halts these forces.

Is the simulation physically and mathematically accurate?

The generators follow the textbook definitions of each model, so the emergent behaviour — the Erdős–Rényi phase transition, Barabási–Albert hubs and Watts–Strogatz small-world regime — is faithfully reproduced. With only up to 120 nodes the statistics fluctuate from run to run, and the layout is a visual aid rather than an exact embedding, so treat numbers as illustrative of the underlying mathematics rather than precise measurements.

Where do these models apply in the real world?

Scale-free structures describe the World Wide Web, citation and protein-interaction networks; small-world structures appear in social networks, neural wiring and power grids; random graphs serve as a baseline for comparison. Understanding which model a real system resembles helps predict its resilience to failure, its vulnerability to targeted attacks on hubs, and how quickly information or disease can spread across it.