Friendships, trade links, web hyperlinks, neural wiring, power grids: all are networks, nodes joined by edges. Network science studies how the pattern of connections shapes what flows through them. The simplest property of a node is how many connections it has.
We will count links and finish with the handshake lemma.
Step 1: Counting links
A network, or graph, is a set of nodes joined by edges; here edges have no direction, and no node links to itself. The degree of a node is its number of edges: count the edges that have it as an endpoint. In the graph with edges 1–2, 1–3, 1–4 and 3–4, node 1 has degree 3, nodes 3 and 4 have degree 2, and node 2 has degree 1. A node with no edges has degree 0.
Step 2: The handshake lemma
Adding up degrees counts every edge twice, once from each end:
In the example the degrees 3, 1, 2 and 2 add up to 8, twice the 4 edges. Degrees (3, 3, 2, 2, 2) give 12/2 = 6 edges, and a network of 40 nodes and 60 edges has mean degree 3. So the degrees of any graph add up to an even number: (2, 1, 1, 1) is impossible. In a simple graph on n nodes no degree can exceed n − 1, so (3, 3, 1) is impossible too, while (3, 1, 1, 1), a star, works.