This 2D companion to the Network Science generator asks a different question: given a network, what spreads across it? A discrete-time SIR (Susceptible–Infected–Recovered) process runs directly on an Erdős–Rényi random graph, so the same giant-component threshold that governs whether the network is even connected also governs whether an outbreak can take off.
The 3D original generates and visualises three landmark network models — Erdős–Rényi, Barabási–Albert and Watts–Strogatz — as static structures. This 2D companion picks one of them, the Erdős–Rényi random graph G(N,p), and puts a dynamical process on top of it: a discrete-time SIR epidemic model. Each infected node independently attempts to infect every susceptible neighbour with probability β on every step; after γ steps of being infectious, a node recovers and becomes immune.
Because the underlying graph is the same G(N,p) model whose connectivity depends on a critical probability p_c ≈ 1/N, the epidemic's fate is coupled to network structure: below the connectivity threshold the graph fragments into small components and an outbreak can only ever reach the component it starts in, no matter how contagious β makes it. Above the threshold, a giant component exists and a large-scale outbreak becomes possible once β and γ push the process past its own epidemic threshold. The live chart tracks susceptible, infected and recovered counts over time, and the stat panel reports the giant component size, an effective reproduction estimate R(t), the epidemic's peak infected fraction and its final attack rate.
What is the SIR model?
SIR divides a population into three states — Susceptible, Infected, Recovered — and tracks how individuals move between them. Here it runs on a network rather than a well-mixed population: infection can only pass along an actual edge, so the graph's structure directly shapes how, and whether, the epidemic spreads.
What do β and γ control?
β is the probability that an infected node passes the infection to a given susceptible neighbour on each simulated step — higher β means faster, more aggressive spread. γ is the number of steps a node stays infectious before recovering — a longer infectious period gives the disease more chances to spread even at a fixed β.
Why does network density (p) matter so much?
p sets how many edges exist, which sets both the average degree and the size of the giant connected component. A sparse network (low p) may fragment into many small, disconnected clusters — an outbreak started in one cluster can never reach the others, capping the final attack rate however contagious the disease is. A denser network lets the giant component span nearly all nodes, removing that structural ceiling.
What is the effective reproduction number R(t) shown here?
It is a simple empirical estimate: the number of new infections produced in the current step divided by the number of currently infectious nodes in the previous step, smoothed slightly. Values above 1 mean the outbreak is still growing; values below 1 mean it is dying out. It is illustrative rather than the formal epidemiological R_t estimator.
A breadth-first search from every unvisited node partitions the graph into connected components; the largest one is the giant component. Its size is reported as a percentage of all nodes and is computed once per generated network, before any epidemic dynamics run, since it is a purely structural property.
If all of the initial infected seeds happen to land in a small, poorly connected component — or their combined immediate neighbourhood is small — random chance can let the small number of infected nodes recover before they infect anyone. Press New Network or increase the seed count to see a range of outcomes; this stochastic fade-out is a genuine feature of network epidemics at small scale, not a bug.
It captures the qualitative behaviour that makes network epidemiology distinct from compartmental (well-mixed) models — percolation-linked outbreak thresholds, degree-dependent spread, stochastic extinction — using the textbook discrete SIR-on-a-graph formulation. It omits demographic structure, variable contact rates, waning immunity and other real-world complications, so treat it as a teaching model of network effects, not a forecasting tool.
Both pages generate the same Erdős–Rényi G(N,p) graphs and use the same force-directed layout for node positions. The 3D page studies the network's static structure — degree distribution, giant component, clustering, across three different generative models. This 2D page fixes the model to Erdős–Rényi and instead studies a dynamic process running on top of it, connecting the earlier percolation threshold directly to epidemic outcomes.