Handshaking Lemma

Describes the relationship between vertex degrees and edges in a graph. Each edge contributes 1 to the degree of each of its endpoints, leading to a fundamental counting principle.

For all the definitions below, consider a graph GG with nn vertices and mm edges.

For Simple Graphs

Sum of all vertex degrees equals twice the number of edges.

i=1ndeg(vi)=2E\sum_{i=1}^{n} \deg(v_i) = 2 |E|

Applies for connected components as well.

Corollary

The number of vertices with odd degree is always even.

For Digraphs

Sum of in-degrees equals sum of out-degrees, both equal to the number of edges.

i=1nindeg(vi)=i=1noutdeg(vi)=m\sum_{i=1}^{n} \text{indeg}(v_i) = \sum_{i=1}^{n} \text{outdeg}(v_i) = m
Written by May 25, 2026 1 min read
Was this helpful?