Chapter 6Graphs and Treesnotes.en.pdf:83

In-degree and Out-degree

How many edges touch each vertex

Def 6.1.3In/out degree
Concept

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 G=V,EG = \langle V, E \rangle and a vertex vVv \in V:

- In-degree counts the edges coming into vv:

indeg(v)=#{w(w,v)E}\text{indeg}(v) = \#\{w \mid (w, v) \in E\}

- Out-degree counts the edges going out of vv:
outdeg(v)=#{w(v,w)E}\text{outdeg}(v) = \#\{w \mid (v, w) \in E\}

For an undirected graph, an edge {w,v}\{w, v\} is incident to both ww and vv, so we
typically just say "degree" and indeg(v)=outdeg(v)\text{indeg}(v) = \text{outdeg}(v).

A useful sanity check is the handshaking lemma for undirected graphs:

vVdeg(v)=2E\sum_{v \in V} \text{deg}(v) = 2 \cdot |E|

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 indeg(v)=0\text{indeg}(v) = 0 (no edges point in).
- A sink has outdeg(v)=0\text{outdeg}(v) = 0 (no edges point out).

Every DAG must have at least one source — we will see this when we study DAGs.

Animation — degree
Transcript — click a line to jump6 cues
  1. 0.0sIn-degree and Out-degree
  2. 1.1sCentral vertex v appears in white
  3. 1.9sFour cyan arrows grow inward from the upper semicircle
  4. 3.3sTwo amber arrows grow outward to the lower semicircle
  5. 4.1sCounters: in-degree = 4, out-degree = 2
  6. 5.5sin-degree counts arrows entering; out-degree counts leaving
Worked example
Step 0 of 2
Practice — score 100% to advance
Multiple choice
Q1
What does indeg(v)\text{indeg}(v) count?
Q2
What is a source vertex?
Q3
For an undirected graph, vdeg(v)=  ?\sum_v \text{deg}(v) = \;?
Q4
For the digraph with edges {(1,2),(2,3),(2,4)}\{(1,2), (2,3), (2,4)\}, outdeg(2)=?\text{outdeg}(2) = ?
Q5
Why is the sum of degrees always even for an undirected graph?
Fill in the blank
Q1
indeg(v)\text{indeg}(v) is the number of edges ___ into vv.
Q2
A vertex with outdeg(v)=0\text{outdeg}(v) = 0 is called a ___.
Q3
For an undirected graph, \sum_v \text{deg}(v) = 2 \cdot |__|.
Loading…