In an undirected graph, the degree of a vertex counts the number of edges incident with that vertex. In a directed graph, this single number splits into two numbers: the number of arcs entering the vertex and the number of arcs leaving the vertex.
These two numbers are called the in-degree and the out-degree. They measure how a vertex receives directed connections and how it sends directed connections. Standard graph terminology defines in-degree as the number of directed edges leading into a vertex, and out-degree as the number leading away from it.
17.1 Incoming and Outgoing Arcs
Let
be a directed graph. The set contains the vertices, and the set contains the arcs. Each arc is an ordered pair
The arc leaves and enters . The vertex is the tail of the arc. The vertex is the head of the arc.
Thus an arc has two local meanings:
| Role | Vertex | Meaning |
|---|---|---|
| Tail | the arc leaves this vertex | |
| Head | the arc enters this vertex |
For a fixed vertex , an arc of the form
is incoming to . An arc of the form
is outgoing from .
Direction matters. The arc contributes to the out-degree of and to the in-degree of . It does not contribute to the in-degree of or the out-degree of .
17.2 In-Degree
The in-degree of a vertex is the number of arcs whose head is . It is denoted by
Formally,
This counts all vertices that send an arc into . If the directed graph is a directed multigraph, then repeated arcs are counted with multiplicity.
The superscript minus sign suggests movement into the vertex. It records incoming incidence.
For example, suppose
Then three arcs enter :
Therefore,
The arc leaves , so it does not increase the in-degree of .
17.3 Out-Degree
The out-degree of a vertex is the number of arcs whose tail is . It is denoted by
Formally,
This counts all vertices reached by an arc leaving . If repeated arcs are allowed, each repeated outgoing arc is counted separately.
The superscript plus sign suggests movement out of the vertex. It records outgoing incidence.
For example, suppose
Then three arcs leave :
Therefore,
The arc enters , so it does not increase the out-degree of .
17.4 In-Neighborhood and Out-Neighborhood
The in-degree and out-degree are often described through neighborhoods.
The out-neighborhood of is
It is the set of vertices reached directly from .
The in-neighborhood of is
It is the set of vertices that point directly into .
For a simple directed graph,
and
For a directed multigraph, this equality may fail if neighborhoods are treated as sets, because several arcs may connect the same ordered pair of vertices. In that case, degree counts arcs, while neighborhood size counts distinct neighboring vertices.
17.5 Example
Let
and
We compute the in-degree and out-degree of each vertex.
For , one arc enters it:
Two arcs leave it:
So
For , one arc enters it:
One arc leaves it:
So
For , four arcs enter it:
Two arcs leave it:
So
For , one arc enters it:
One arc leaves it:
So
For , no arcs enter it. One arc leaves it:
So
The result is summarized below.
| Vertex | In-degree | Out-degree |
|---|---|---|
| 1 | 2 | |
| 1 | 1 | |
| 4 | 2 | |
| 1 | 1 | |
| 0 | 1 |
17.6 Sources and Sinks
A vertex with in-degree zero is called a source. It has no incoming arcs. A vertex with out-degree zero is called a sink. It has no outgoing arcs. These names are standard in directed graph theory.
Thus is a source if
The vertex is a sink if
In the example above, is a source, since no arc enters . There is no sink, since every vertex has at least one outgoing arc.
Sources and sinks are important in applications. In a dependency graph, a source may represent a task with no prerequisites. A sink may represent a task on which no later task depends. In a flow network, a source sends flow into the network, while a sink receives flow from the network.
17.7 Balanced Vertices and Balanced Directed Graphs
A vertex is balanced if its in-degree equals its out-degree:
A directed graph is balanced if every vertex is balanced. Balanced directed graphs are important in the study of Eulerian circuits, because a directed Eulerian circuit requires each vertex to have the same number of incoming and outgoing arcs, together with the appropriate connectivity condition.
For example, in the directed cycle
each vertex has one incoming arc and one outgoing arc. Therefore each vertex is balanced.
In contrast, in the directed path
we have
Only is balanced.
17.8 Total In-Degree and Total Out-Degree
For every finite directed graph,
This identity is the directed version of the handshaking lemma. Each arc has exactly one tail and exactly one head. Therefore each arc contributes to the total out-degree and to the total in-degree.
The proof is immediate from double counting.
Count the arcs by their tails. Each arc is counted once in the out-degree of its tail, so
Count the same arcs by their heads. Each arc is counted once in the in-degree of its head, so
Therefore the two sums are equal. This formula is a standard property of directed graphs.
17.9 Loops
A loop is an arc of the form
It leaves and enters at the same time. Therefore a loop contributes to the out-degree of and to the in-degree of . This convention preserves the identity
For example, if , then
The single loop is counted once as incoming and once as outgoing.
17.10 Degree Sequences of Directed Graphs
The degree sequence of a directed graph records the in-degree and out-degree of each vertex.
For a directed graph with vertices
the directed degree sequence may be written as
Some authors list the out-degree first. The convention must be stated before use.
A degree sequence is a graph invariant. If two directed graphs are isomorphic, then their degree sequences agree after a suitable relabeling of vertices. The converse does not hold in general. Two non-isomorphic directed graphs may have the same degree sequence.
A necessary condition for a list of pairs
to be the degree sequence of a finite directed graph is
Both sums must equal the number of arcs. This condition alone may not be sufficient when loops or multiple arcs are restricted.
17.11 Degree and Adjacency Matrices
Let be a directed graph with vertices
Its adjacency matrix is the matrix defined by
In a simple directed graph, the out-degree of is the sum of row :
The in-degree of is the sum of column :
Rows describe arcs leaving a vertex. Columns describe arcs entering a vertex.
For example, let
The first row has sum , so
The first column has sum , so
This matrix view is useful in algorithms and spectral graph theory. It allows degree calculations through row sums and column sums.
17.12 Degree and Incidence Matrices
The incidence matrix also records in-degree and out-degree.
Let be the directed incidence matrix using the convention
Then the number of entries in row is the out-degree of . The number of entries in row is the in-degree of .
This representation is especially useful when arcs carry flow. A positive entry means flow enters the vertex through that arc. A negative entry means flow leaves the vertex through that arc.
17.13 Interpretation in Networks
In-degree and out-degree often have direct meaning.
| Network | In-degree | Out-degree |
|---|---|---|
| Web graph | number of pages linking to a page | number of links from a page |
| Social follow graph | number of followers | number of followed accounts |
| Citation graph | number of later papers citing a paper | number of cited references |
| Dependency graph | number of prerequisites or dependents, depending on convention | opposite direction count |
| Road network | number of incoming one-way roads | number of outgoing one-way roads |
| Control-flow graph | number of incoming control paths | number of outgoing control paths |
The direction convention must always be checked. In a dependency graph, one author may write to mean must happen before . Another may write to mean depends on . These conventions reverse the interpretation of in-degree and out-degree.
The mathematics remains the same. The interpretation depends on the meaning assigned to each arc.
17.14 Common Mistakes
A common mistake is to count adjacent vertices without considering direction. In a directed graph, adjacency alone does not determine degree. One must distinguish incoming arcs from outgoing arcs.
Another mistake is to assume that and are the same. They are different arcs. If both are present, each contributes separately.
A third mistake is to forget the loop convention. A loop contributes to both in-degree and out-degree. It does not contribute twice to either one.
A fourth mistake is to interpret degree sequence as a complete description of a graph. Degree sequences give useful summaries, but they rarely determine a directed graph uniquely.
17.15 Summary
In-degree and out-degree refine the notion of degree for directed graphs.
The in-degree of counts arcs entering :
The out-degree of counts arcs leaving :
A source has in-degree zero. A sink has out-degree zero. A balanced vertex has equal in-degree and out-degree.
For every finite directed graph,
This identity follows because every arc has one tail and one head. In-degree and out-degree are elementary local quantities, but they support many later topics: directed paths, strong connectivity, Eulerian circuits, flow networks, ranking systems, dependency graphs, and directed graph algorithms.