A directed graph is a graph in which each edge has a direction. Instead of merely saying that two vertices are adjacent, a directed graph records an ordered relation from one vertex to another.
Directed graphs are also called digraphs. Their directed edges are often called arcs. Formally, a directed graph is an ordered pair
where is a set of vertices and is a set of ordered pairs of vertices. An ordered pair represents an arc from to . The first vertex is the tail, source, or initial vertex of the arc. The second vertex is the head, target, or terminal vertex of the arc. This ordered-pair definition is the standard distinction between directed and undirected graphs, where undirected edges are unordered pairs.
16.1 From Undirected Graphs to Directed Graphs
In an undirected graph, the edge has no direction. It connects and symmetrically. If is adjacent to , then is adjacent to .
In a directed graph, the arc has direction. It goes from to . The existence of does not imply the existence of .
Thus the two arcs
are distinct.
This distinction is essential. Many relations are asymmetric. A web page may link to another page without receiving a link back. A person may follow another person on a social network without being followed in return. A task may depend on another task without the reverse dependence being true. A directed graph records such one-way structure.
16.2 Arcs
Let be a directed graph. If , then there is an arc from to .
The vertex is called the tail of the arc. The vertex is called the head of the arc. We also say that the arc leaves and enters .
The vertex is an out-neighbor or successor of . The vertex is an in-neighbor or predecessor of . These terms are common in directed graph terminology and follow directly from the orientation of an arc.
For a vertex , we define its out-neighborhood by
This is the set of vertices reached by arcs leaving .
We define its in-neighborhood by
This is the set of vertices that have arcs entering .
16.3 In-Degree and Out-Degree
In an undirected graph, the degree of a vertex counts incident edges. In a directed graph, incident arcs must be counted with direction.
The out-degree of a vertex , denoted , is the number of arcs leaving :
The in-degree of , denoted , is the number of arcs entering :
A vertex with in-degree zero is called a source. A vertex with out-degree zero is called a sink. In the usual terminology, a source has no incoming arcs, while a sink has no outgoing arcs.
For example, suppose
and
Then
Therefore,
The total out-degree over all vertices equals the total in-degree over all vertices:
Each arc contributes one to the out-degree of its tail and one to the in-degree of its head.
16.4 Simple Directed Graphs, Loops, and Multiple Arcs
A simple directed graph usually has no loops and no repeated arcs. A loop is an arc of the form
It begins and ends at the same vertex.
A directed multigraph allows multiple arcs with the same tail and head. For example, it may contain several copies of . Such graphs are useful when arcs represent distinct objects: several flights from one city to another, several communication channels, or several transitions between two states.
A directed graph with loops allows arcs from a vertex to itself. Whether loops are allowed depends on the convention of the text or application. For this book, unless otherwise stated, a directed graph means a finite directed graph without repeated arcs. Loops will be allowed only when explicitly mentioned.
16.5 Underlying Undirected Graph
Every directed graph has an underlying undirected graph. It is obtained by replacing each arc with the undirected edge , ignoring direction.
If both and occur, they still correspond to the same undirected edge in the underlying graph, unless multiplicities are being kept.
The underlying graph is useful when we want to study ordinary connectivity while temporarily ignoring direction. For example, a directed graph may be weakly connected because its underlying undirected graph is connected, even though not every vertex can reach every other vertex by directed paths.
16.6 Orientation of an Undirected Graph
An orientation of an undirected graph is obtained by assigning a direction to each edge.
If is an undirected graph, then an orientation of replaces each edge by exactly one of the arcs
The resulting directed graph is called an oriented graph.
An oriented graph has no pair of opposite arcs between the same two vertices. That is, it cannot contain both and . This distinguishes an oriented graph from a general directed graph, where both directions may occur.
Orientations are useful when an undirected relationship receives direction from a rule. A road network may assign directions to streets. A tournament may orient each edge from the winner to the loser. A dependency graph may orient an edge from a prerequisite to a dependent task.
16.7 Directed Walks, Paths, and Cycles
A directed walk is a sequence of vertices
such that
for each .
The direction of every arc must be followed. It is not enough that the vertices are adjacent in the underlying graph.
A directed path is a directed walk with no repeated vertices. A directed cycle is a directed path together with an arc from the last vertex back to the first.
Thus a directed cycle has the form
Directed cycles are important because they represent circular dependence. If depends on , depends on , and depends on , then no object in the cycle can be completed before the others.
16.8 Reachability
A vertex is reachable from a vertex if there exists a directed path from to .
Reachability is directional. It may be true that is reachable from , while is not reachable from .
For example, if
then is reachable from , but is not reachable from .
Reachability is one of the central relations in directed graph theory. It appears in program analysis, dependency resolution, network routing, database queries, automata theory, and scheduling.
16.9 Strong and Weak Connectivity
Directed graphs have more than one useful notion of connectivity.
A directed graph is weakly connected if its underlying undirected graph is connected. Direction is ignored.
A directed graph is strongly connected if for every pair of vertices , there is a directed path from to and also a directed path from to . Standard graph theory distinguishes weak connectivity from strong connectivity in exactly this way.
Strong connectivity is stricter. It says that every vertex can reach every other vertex while respecting directions.
For example, the directed cycle
is strongly connected. From any vertex, one can follow directions around the cycle to reach any other vertex.
The directed path
is weakly connected but not strongly connected. Its underlying undirected graph is connected, but there is no directed path from back to .
16.10 Adjacency Matrix of a Directed Graph
Let be a directed graph with vertices
The adjacency matrix of is the matrix defined by
Rows represent tails. Columns represent heads.
For example, if
and
with vertex order , then
The entry in row , column is , because there is an arc from to . The matrix need not be symmetric. Symmetry would mean that whenever is present, is also present.
For directed multigraphs, the entry may count the number of arcs from to . This convention is common for multidigraphs and graphs with loops.
16.11 Incidence Matrix of a Directed Graph
Another useful representation is the incidence matrix.
Let , where
and
The incidence matrix is an matrix . Each column corresponds to an arc.
For an arc , one common convention is
Thus the tail receives , and the head receives .
This matrix form is useful in flow problems, electrical networks, conservation laws, and optimization. The signs encode direction.
16.12 Directed Acyclic Graphs
A directed acyclic graph, or DAG, is a directed graph with no directed cycles.
DAGs are fundamental in scheduling and dependency analysis. If an arc means that must occur before , then a directed cycle would mean that some task must occur before itself through a chain of dependencies. This is impossible.
For example,
is a DAG. It says that must precede both and , and both and must precede .
DAGs admit topological orderings, which will be studied in a later chapter. A topological ordering lists the vertices so that every arc goes from an earlier vertex to a later vertex.
16.13 Tournaments
A tournament is an orientation of a complete graph.
For every pair of distinct vertices and , exactly one of the arcs
is present.
Tournaments model pairwise competitions. If , then defeated . Since every pair competes, exactly one directed edge is assigned between every two vertices.
Tournaments provide a simple but rich class of directed graphs. They contain many nontrivial questions about ranking, dominance, cycles, and transitive subtournaments.
16.14 Directed Graphs as Relations
A directed graph can be viewed as a binary relation on a set.
Let be a set. A binary relation on is a subset of
A directed graph has exactly this form, since
Thus directed graphs provide a visual and combinatorial language for relations.
If , then is related to . Properties of relations correspond to properties of directed graphs:
| Relation property | Graph interpretation |
|---|---|
| Reflexive | Every vertex has a loop |
| Symmetric | Every arc has the reverse arc |
| Antisymmetric | No two distinct vertices have arcs both ways |
| Transitive | If and , then |
| Acyclic | No directed cycle |
This connection explains why directed graphs appear throughout discrete mathematics, order theory, logic, and computer science.
16.15 Applications
Directed graphs model systems with one-way relations.
| Application | Vertices | Arcs |
|---|---|---|
| Web graph | Web pages | Links |
| Social network | Accounts | Follows |
| Task scheduling | Tasks | Dependencies |
| Compiler analysis | Program blocks | Control flow |
| Automata | States | Transitions |
| Transportation | Locations | One-way routes |
| Knowledge graph | Entities | Directed relations |
| Version control | Commits | Parent relations |
| Build systems | Files or targets | Dependency edges |
In each case, direction carries meaning. Ignoring direction may destroy the structure of the problem.
For example, in a dependency graph, an arc
may mean that depends on . Reversing this arc changes the meaning completely.
16.16 Summary
A directed graph is a graph whose edges have direction. It is written as
where is a set of vertices and is a set of ordered pairs of vertices.
The main objects are arcs, tails, heads, in-neighbors, out-neighbors, in-degree, out-degree, directed paths, reachability, and directed cycles. Directed graphs support richer connectivity notions than undirected graphs, especially weak and strong connectivity.
Directed graphs are the natural language of asymmetric structure. They describe links, dependencies, flows, transitions, precedence, control, and reachability. Subsequent chapters develop these ideas through directed paths, strong components, acyclic graphs, topological ordering, weighted digraphs, and directed graph algorithms.