145. Miscellaneous topics about digraphs

145.1 Definition: loop

An arrow $a$ from a node to itself, in other words $a:x\to x$ for some node $x$, is called a loop.

145.1.1 Example $u$ is a loop in the left digraph in Figure (144.1).

145.2 Definition: indegree and outdegree

The number of arrows that have a node as source is called the outdegree of the node, and the number of arrows that have the node as target is the indegree.

145.2.1 Example The node $y$ in the left graph of Figure (144.1) has indegree 4 and outdegree 1.

145.3 Definition: opposite of a graph

The opposite of a digraph $G$ is the digraph with the same nodes and all the arrows reversed. It is called $G^{\mathrm{op}}$. Thus if $G=\langle G_0,G_1,s,t\rangle$, then $G^{\mathrm{op}}=\langle G_0,G_1,t,s\rangle$.

145.3.1 Example The digraphs below are opposites of each other.

Two digraphs on nodes A, B, C, D: on the left arrows A to B, A to C, A to D, B to D and D to B; on the right the same arrows reversed

145.4 Labeling

A labeling of the nodes of a digraph $G$ is a function $L:G_0\to S$, where $S$ is a set. If $x$ is a node, its label is $L(x)$. Similarly a function $L:G_1\to S$ would label the arrows. As an example, the digraph below shows the cost of traveling by rail in a (mythical) mountainous country between three cities $A$, $B$, and $C$. (The fare for going to a higher elevation is more than for going to a lower one.)

Digraph on cities A, B, C with arrows labeled by cost: B to A 130, A to B 100, A to C 120, C to A 90, B to C 90, C to B 90 (145.1)

The nodes are labeled by $\{A,B,C\}$ and the arrows are labeled by integers representing cost. Here the labeling is a function $F:G_1\to\mathrm{Z}$. A function labeling arrows by integers or real numbers is commonly called a weight function on the arrows. You can see that the labeling of the nodes is injective but the labeling of the arrows is not. When the labeling of the nodes is injective, there is usually no harm in taking the attitude that the labels are actually the nodes; a similar remark applies to an injective labeling of the arrows.

Pages 220–221 of the book (PDF).