Let have two nonadjacent neighbours in a finite graph , with connected. Then . Give one common colour. In a spanning tree of the remaining graph rooted at , order vertices from larger to smaller distance from the root and colour greedily in that order. Every vertex before has an uncoloured parent, so at most colours are forbidden there. At , the two initial neighbours use the same colour, so again at most distinct colours are forbidden. This constructs a proper colouring from a palette of colours. It is a useful local step in Brooks' theorem.
The Brooks' theorem states that a finite connected simple graph with maximum vertex degree has chromatic number at most , unless it is a complete graph or an odd cycle graph; those exceptions have chromatic number .
First, if the graph is not regular, choose a vertex of degree less than and a spanning tree rooted at . Order vertices with every child before its parent, and apply the greedy coloring algorithm. Every vertex except has an as-yet uncolored parent, so has at most colored neighbors; also has fewer than neighbors. Thus colors suffice. This justifies reducing to the regular case.
Now let be regular, 3-connected and not complete. A shortest path between two nonadjacent vertices contains an induced two-edge path with nonadjacent. By 3-connectivity, is connected. Color with the same color. Choose a spanning tree of the remaining graph rooted at and color its vertices in child-before-parent order. Each vertex other than again has an uncolored parent and thus at most already colored neighbors. At the last vertex , the two neighbors share a color, so its neighbors use at most distinct colors. A color is therefore available at every step, proving in the required 3-connected noncomplete case. A 3-connected graph has , so the odd-cycle exception cannot arise here.
A graph is -connected when it has more than vertices and remains connected after deletion of fewer than vertices. In a noncomplete 3-connected graph, choose a vertex with two nonadjacent neighbors . Since is connected, take a spanning tree rooted at and order its vertices so every vertex other than has a later tree neighbor. Color and first with the same color, then greedily color the other vertices in reverse tree order, leaving last. Every nonfinal vertex has one uncolored neighbor and therefore sees at most colors. At , the two neighbors share a color, so again at most colors occur. Hence
This is the relevant 3-connected case of Brooks' theorem.