🌐

Networks & Graph Theory

The mathematics of connections: shortest paths, optimal tours, spanning trees, and viruses spreading across social graphs. Visualise algorithms one step at a time.

6 simulations Canvas 2D · WebGL Shortest Path · TSP · SIR

Category Simulations

Graphs, paths, flows and spreading processes

Graph theory underpins the modern world — routing packets across the Internet, mapping protein interactions, scheduling airline connections and modelling how information (or disease) spreads through a social network. Here you can interact with the core algorithms step by step.

🗺️
★★☆ Moderate
Pathfinding Algorithms
Interactive grid where you can paint walls, move start/goal, and compare A*, Dijkstra and BFS side by side — open and closed node sets shown live.
Canvas 2D A* Dijkstra BFS
✈️
★★☆ Moderate
Travelling Salesman Problem
Place cities and watch Nearest-Neighbour, 2-Opt, 3-Opt and simulated annealing compete for the shortest Hamiltonian tour across all nodes.
Canvas 2D TSP 2-Opt Annealing
🧬
★★☆ Moderate
Genetic Algorithm
Evolve solutions on a network-style fitness landscape using selection, crossover and mutation operators. Watch population fitness converge.
Canvas 2D GA Crossover Mutation
🦠
★☆☆ Beginner
Epidemic Spreading (SIR)
SIR / SEIR / SIS compartmental model with interactive β and γ sliders. Watch the infection curve flatten or explode depending on R₀ value.
Canvas 2D SIR ODE R₀
🔗
★★★ Advanced
Force-Directed Graph
Visualise arbitrary graphs with Fruchterman-Reingold spring simulation. Degree-coloured nodes, live degree-distribution chart.
Canvas 2D Force Layout Barabási-Albert
🌲
★★☆ Moderate
Minimum Spanning Tree
Kruskal's and Prim's algorithms animated on a weighted random graph. Toggle between algorithms; edge costs shown on arcs.
Canvas 2D Kruskal Prim
🕸️
★★☆ Moderate
Network Resilience
Barabási–Albert scale-free networks under targeted hub attack vs random failure — watch giant component collapse.
Force Layout Scale-Free Percolation Graph Theory
🌐
★★☆ Moderate New
Small-World Network
Watts-Strogatz rewiring: start from a regular ring lattice and gradually add random long-range links. Watch clustering coefficient stay high while average path length plummets — the hallmark of social networks, the brain and the internet.
Watts-Strogatz Clustering Path Length Canvas 2D
🌐
New ★★☆ Moderate
Network Science
Erdős–Rényi, Barabási–Albert scale-free and Watts–Strogatz small-world graphs with force-directed layout. Live degree distribution histogram, clustering coefficient and giant-component fraction update in real time.
Erdős–Rényi Barabási–Albert Force-Directed

Key Concepts

Core graph theory and network science ideas

Graph Representations
Adjacency matrix O(V²) storage, adjacency list O(V+E). Dense graphs favour matrix for O(1) edge lookup; sparse graphs favour lists for traversal. Weighted graphs add cost to each edge — fundamentals for every pathfinding algorithm.
Shortest Path (A*)
f(n) = g(n) + h(n): g is the exact cost from start, h is the heuristic estimate to goal. An admissible (never-overestimating) heuristic guarantees the optimal path. Dijkstra is A* with h=0. Bi-directional search and Jump Point Search speed up grids.
Network Centrality
Degree centrality counts edges per node. Betweenness centrality counts how many shortest paths pass through a node — critical hubs in transport and social networks. PageRank extends eigenvector centrality to directed weighted networks.
Spreading Processes
SIR model on a network: each infected node spreads to each susceptible neighbour with probability β per step. Recovery at rate γ. Basic reproduction number R₀ = β/γ × average degree. Herd immunity threshold 1 − 1/R₀.

Learning Resources

Articles and references about graph algorithms

About Networks & Graph Theory Simulations

Social networks, epidemic spread, random graphs, and connectivity — visualised

Networks and graph theory simulations model the structure and dynamics of interconnected systems. Network-growth simulations implement preferential attachment (the Barabási–Albert model) and show how hubs emerge naturally in real-world networks like the internet, social platforms, and airline routes. SIR epidemic simulations propagate infections across contact networks, demonstrating why highly-connected hubs are disproportionately important for disease control.

Community detection algorithms partition nodes into clusters using spectral methods and label propagation. Shortest-path visualisers run Dijkstra and BFS on weighted graphs with hundreds of nodes, animating the frontier expansion. These tools model the same graph-theory concepts underlying Google's PageRank, Facebook's friend recommendations, power-grid resilience analysis, and epidemiological contact tracing.

Network theory is one of the most cross-disciplinary sciences of the 21st century. The same mathematical frameworks describe the internet, metabolic networks, power grids, social relationships, and ecological food webs. Graph theory originated with Euler's 1736 solution to the Königsberg bridge problem and has since become essential to algorithm design, epidemiology, neuroscience, and the study of complex systems in virtually every domain.

Key Concepts

Topics and algorithms you'll explore in this category

Scale-Free NetworksBarabási-Albert preferential attachment model
Small-World NetworksWatts-Strogatz rewiring: short paths, high clustering
Percolation TheoryCritical connectivity threshold for network resilience
Centrality MeasuresDegree, betweenness, closeness, eigenvector centrality
Epidemic SpreadingSIR dynamics on network topology
Graph Spectral TheoryLaplacian eigenvalues and network properties

Frequently Asked Questions

Common questions about this simulation category

What makes a network scale-free?
A scale-free network follows a power-law degree distribution P(k) ~ k^(-γ). They form through preferential attachment: new nodes connect preferentially to already well-connected nodes ('the rich get richer'). The internet, citation networks, and social networks are all approximately scale-free.
What is the small-world phenomenon?
The small-world property means most node pairs are connected by a surprisingly short path (low average path length) while most nodes cluster locally (high clustering coefficient). The Watts-Strogatz model generates small-world networks by randomly rewiring a small fraction of a regular lattice's edges.
How does disease spread on a network?
Network structure dramatically affects epidemic dynamics. Hub nodes (highly connected) are super-spreaders: targeting them with vaccination is far more efficient than random vaccination. The percolation threshold determines the minimum fraction of nodes that must be immunised to prevent a network-wide epidemic.

Other Categories