# 2.5 Digraphs: Walks & Paths

## Counting Paths

Suppose we have a complete directed graph of 5 vertices with no self-edge.

That is, for any $$i, j = 1, 2, 3, 4, 5$$, edge $$(v_i, v_j)$$ exists iff $$i \neq j$$.

How many edges are in the graph?:

Exercise 1

What is the length of the longest path not containing a cycle?

Exercise 2

How many paths are there that satisfy the previous condition?

Exercise 3

Explanation

If every edge were connected, there would be $$5\cdot 5 = 25$$ edges. However, there are no self-edges, so we've over-counted by $$5$$ and there are $$20$$ total.

$$5$$ unique vertices can be connected by $$4$$ edges, so a $$5$$th edge is guaranteed to create a cycle.

Visting the $$5$$ vertices in any order works. Thus, there are $$5$$ possibilities for the start vertex, $$4$$ for the second, $$3$$ for the third, $$2$$ for the fourth, and the final one is whatever's left. This gives $$5 \cdot 4 \cdot 3 \cdot 2 \cdot 1 = 120$$ possible paths.