Standard 7: Graph Traversal 1: Graphs and Trees


Short description: Use graph terminology; prove statements about graphs, trees, and paths.

Relevant notes: Topic C: Graph Traversal.

Full description

Utilize formal definitions of graphs, trees, and related terminology. Compare adjacency matrices to adjacency lists. Prove basic facts about graphs and trees.

Example problem

Part a. Prove using induction that a binary tree of height $d$ has at most $2^d$ leaves.

Hint: use the inductive definition of a binary tree.


Part b. A directed graph is called strongly connected if there is a path from every vertex to every other vertex, following the directions of the edges. Give an example of a directed graph where:

Briefly explain.

Solution

Part a.

The base case is a binary tree consisting of one vertex and no edges. That vertex is a leaf. So there are $1 = 2^0 = 2^d$ leaves.

For the inductive case, by the inductive definition of a binary tree, it is of the form of a root with at most two children, each of which is the root of a binary tree. Suppose without loss of generality that the heights of these subtrees are $k_1 \leq k_2$. By inductive hypothesis, the number of leaves in each subtree is at most $2^{k_1}$ and $2^{k_2}$ respectively. Each child's binary tree is of height at most $d-1$, so each child's tree has at most $2^{d-1}$ leaves. The leaves of the new tree consist of all leaves of the old tree, so there are at most $2^{d-1} + 2^{d-1} = 2^d$ leaves.


Part b.

Here is one example.

Two length-3 cycles with a one-way edge from one to the other.

Here, there are two $3$-cycles. Each vertex is part of one of the $3$-cycles. But there is a single edge from a vertex in the first cycle to a vertex in the second. Vertices in the first can reach the second, but not vice versa.

Rubric

To pass, a solution must pass both parts. The overall score is the minimum of the two scores.

Part a.

To pass, a solution must follow the course requirements for writing and proofs. It must also follow the inductive proof.

To pass, the solution should use the inductive definition of a binary tree as either a single node, or a root connected to one or two binary trees. It should clearly apply the inductive hypothesis.

The numerical rubric for this problem is:


Part b.

To pass, a solution must give a directed graph that is clear and easy to understand (preferably as a clear diagram). It must correctly answer the question. The explanation can be quite brief as long as the graph is correct.

The numerical rubric for this problem is: