149. Paths and circuits
149.1 Definition: directed walk
A directed walk of length $k$ from a node $p$ to a node $q$ in a digraph is a tuple $\langle a_1,\ldots,a_k\rangle$ of arrows for which
P.1 source$(a_1)=p$;
P.2 target$(a_k)=q$; and
P.3 if $k>1$, then for each $i=1,\ldots,k-1$, source$(a_{i+1})=$ target$(a_i)$.
149.1.1 Remarks
a) By definition, the length of a directed walk is the number of arrows it goes through. If it goes through an arrow twice, the arrow is counted twice. A directed walk of length $n$ will thus make $n+1$ visits to nodes, counting the start and finish nodes, and the same node may be visited more than once.
b) We allow the empty walk $\langle\rangle$ from any node to itself.
149.1.2 Example All these refer to digraph (149.1) below.
a) The walk $\langle u\rangle$ on the left digraph is of length one and touches the node $y$ twice.
b) The empty walk $\langle\rangle$ from $y$ to $y$ is also a walk (of length 0); it is not the same as $\langle u\rangle$.
c) The walk $\langle c,d,e\rangle$ goes from $z$ to $y$ and touches $z$ twice.
d) The walk $\langle c,d,c,d\rangle$ goes from $z$ to $z$ and touches each of $x$ and $z$ twice.
e) $\langle e,a,d\rangle$ is not a directed walk because an arrow goes the wrong way.

149.2 Definition: directed path
A directed path is a directed walk in which the arrows $a_1,\ldots,a_k$ are all different.
149.2.1 Example In the digraph (149.1):
a) $\langle c,a,u\rangle$ is a directed path of length 3 from $z$ to $y$.
b) $\langle d,c,a\rangle$ is a directed path of length 3 from $x$ to $y$.
c) $\langle e\rangle$ is a directed path of length 1 from $z$ to $y$.
d) $\langle d,c,d,e\rangle$ is a directed walk that is not a directed path.
149.3 Definition: directed circuit
A directed circuit is a directed path from a node to itself.
149.3.1 Remark A directed circuit must be a path, not merely a walk.
149.3.2 Example In the digraph (149.1), the only directed circuits are the three empty paths, $\langle c,d\rangle$, $\langle d,c\rangle$ and $\langle u\rangle$. (Thus a loop is a directed circuit.)
149.4 Definition: simple directed path
A simple directed path is a directed path not containing any directed circuits, so that you never hit a node twice.
149.4.1 Example The only simple directed paths from $z$ to $y$ in the digraph (149.1) are $\langle c,a\rangle$, $\langle c,b\rangle$, and $\langle e\rangle$.
149.4.2 Example Programs in many languages such as Pascal are made up of procedures or functions that call on each other. It is often useful to draw a digraph in which the nodes are the procedures and functions and there is an arrow from $P$ to $Q$ if $Q$ is called when $P$ is run. A loop in such a digraph indicates a procedure or function that calls itself recursively. Larger circuits indicate indirect recursion.
149.4.3 Exercise Find all the simple directed paths from 1 to 3 in the digraph $G=(G_0,G_1,s,t)$, where $G_0=\{1,2,3\}$, $G_1=\{a,b,c,d,e\}$, $s(a)=s(e)=1$, $s(b)=s(c)=s(d)=2$, $t(a)=2$, $t(b)=t(c)=1$, and $t(d)=t(e)=3$. (This is the same as the digraph in Exercise 144.2.2(b).) (Answer on page 251.)
149.4.4 Exercise A digraph is transitive if whenever there are arrows $x\to y$ and $y\to z$, there must be an arrow $x\to z$. Show that a digraph is transitive if and only if whenever there is a walk from $x$ to $y$ there is an arrow $x\to y$.
Pages 225–227 of the book (PDF).