## Graph Theory Lecture Notes 6

### Tree Growing

Let G be a graph and T a tree which is a subgraph of G. A *frontier edge* of G is an edge which has exactly one endpoint in T.
A *standard vertex labeling* of a graph is an assignment of consecutive integers, starting at either 0 or 1, to the vertices of the graph.

**Tree Growing Algorithm**

**Corollary 4.1.3:** A graph is connected if and only if the basic tree-growing algorithm labels all its vertices.

Forest growing

Tree growing in a digraph

### Depth-First and Breadth-First Search

These are tree growing algorithms which specify how the frontier edge is to be chosen in different ways.
*Depth-First Search:* Choose the frontier edge which has the largest label.

**Proposition 4.2.1:** Let T be the spanning tree produced by a depth-first search on an undirected connected graph. Let e be a non-tree edge of the graph with endpoints x and y. If the label of x < label of y, then x is an ancestor of y in T.

*Breadth-First Search:* Choose the frontier edge which has the smallest label.

**Proposition 4.2.2:** When breadth-first search is applied to an undirected connected graph, the endpoints of each non-tree edge are either at the same level or at consecutive levels in the tree produced.

### Applications of Depth-First Search

**Component Finding**
**Finding Cut-vertices of a connected graph**

**Proposition 4.3.1:** A vertex v in a connected graph is a cut-vertex if and only if there exist two distinct vertices u and w, both different from v, such that v is on every u-w path in the graph.

**Proposition 4.3.2:** Let tree T be the result of applying depth-first search to a connected graph G. Then the root r of T is a cut-vertex of G if and only if r has more than one child in T.

**Proposition 4.3.3:** Let tree T be the result of applying depth-first search to a connected graph G. Then a non-root v of T is a cut-vertex of G if and only if v has a child w such that no descendant of w is joined to an ancestor of v by a non-tree edge.

Let low(w) be the smallest label assigned to the vertices w and all vertices joined by a non-tree edge to a descendant of w.

**Corollary 4.3.4:** Let tree T be the result of applying depth-first search to a connected graph G. Then a non-root v of T is a cut-vertex of G if and only if v has a child w such that low(w) label of v.

Using these ideas we can find cut-vertices with the following algorithm:

**Algorithm 4.3.2: Finding Cut-Vertices**

Initialize set K as empty.

Choose an arbitrary vertex r from the graph.

Do a depth-first search starting at r, resulting in tree T.

If root r has more than one child in T, add r to K.

For each vertex w, compute low(w).

For each non-root v, if there is a child u of v with low(u) label of v, add v to K.

Output K, the set of cut-vertices of the graph.