In-degree and Out-degree
How many edges touch each vertex
How many edges touch each vertex? That's what degree measures, and it's the
single most useful local property of a graph.
Definition 6.1.3 (notes p. 83) defines the degree functions. For a directed
graph and a vertex :
- In-degree counts the edges coming into :
- Out-degree counts the edges going out of :
For an undirected graph, an edge is incident to both and , so we
typically just say "degree" and .
A useful sanity check is the handshaking lemma for undirected graphs:
Every edge contributes 1 to the degree of each of its two endpoints — so it is
counted twice when we sum degrees. This gives us a quick way to bound the number
of edges from the sum of degrees.
Sources and sinks are special cases (Definition 6.1.6):
- A source has (no edges point in).
- A sink has (no edges point out).
Every DAG must have at least one source — we will see this when we study DAGs.
- 0.0sIn-degree and Out-degree
- 1.1sCentral vertex v appears in white
- 1.9sFour cyan arrows grow inward from the upper semicircle
- 3.3sTwo amber arrows grow outward to the lower semicircle
- 4.1sCounters: in-degree = 4, out-degree = 2
- 5.5sin-degree counts arrows entering; out-degree counts leaving