Solution

ID: past-exam-of-the-year-1-of-the-computer-science-course-of-the-university-of-oxford/2013/functional-programming-design-and-analysis-of-algorithms/5/b/solution

A graph path of length at most either already has length at most , or consists of a prefix of length at most followed by one edge. Therefore
The forward implication follows by removing the final edge of a nonempty graph path. Conversely, concatenating the indicated prefix and edge gives a walk of length at most , and removing repetitions if necessary gives a graph path no longer than that walk.
Writing for Boolean matrix multiplication, the formula is . Because includes the identity matrix, an equivalent formula is
Compute each new matrix from an unchanged copy of the preceding matrix, so the subscript continues to specify exactly the length bound.

New to topics? Read the docs here!