# 3-coloring of specific planar graphs

Consider any tree $T$ with $n>2$ vertices and $k$ leaves. Let's denote $G(T)$ a graph constructed from $T$ by connecting its leaves into $k$-cycle in such way that $G(T)$ is planar.

In case I wasn't clear enough I'll give an example:

Let T be a tree with edges E(T) = { {1,2}, {2,3}, {2,4}, {4,5} } and then E(G(T)) = sum of the sets: E(T) and { {1,5}, {5,3}, {3,1} }, since we are connecting leaves 1,5,3 into a cycle.

And I believe that if $T$ is not $K_{1,2r+1}$ then $G(T)$ is $3$-colorable, but my problem is I don't know how to prove it. I was trying to come up with an algorithm that starts with $2$-coloring of a tree and then with third color fix collisions on a cycle, but this led me to nowhere.

• It would seem easier to colour the cycle first, trying to use colours so that the parents of leaves at the same level are assigned only two colours. – András Salamon Apr 21 '13 at 13:29
• This question appears to be crossposted in MathOverflow. mathoverflow.net/questions/128169/… – fidbc Apr 21 '13 at 21:10

To prove that every tree with two or more internal nodes gives you a 3-colorable graph, use induction on the number of nodes of the tree. If you orient the tree from an arbitrarily chosen root node, there always exists an internal node $v$ whose children are all leaves. Now split into cases:

• If $v$ has one child, then the graph can be reduced down to nothing by repeatedly removing vertices of degree at most two, and three-colored by reinserting the vertices in the reverse order and giving them a color distinct from their two neighbors.

• If $v$ has three or more children, then the tree can be reduced in size by removing two consecutive children, forming the graph by connecting the remaining leaves into a cycle, and then coloring the smaller graph. The remaining children of $v$ must alternate in color and reinserting the removed children maintains the same alternation.

• If $v$ has exactly two children, and there are three or more internal nodes, then remove $v$ and its two children from $T$, form the graph by connecting the remaining leaves into a cycle, and then color it. Let $p$, $q$, and $r$ be the parent of $v$, the node to the left of $v$'s left child in the leaf cycle, and the node to the right of $v$'s right child in the leaf cycle; $q$ and $r$ are adjacent in the smaller graph, so must have different colors. There are two subcases. If $p$, $q$, and $r$ use only two colors among them, then the two children of $v$ can be colored in alternation with $q$ and $r$ using the same two colors, and $v$ can be given the remaining third color. On the other hand, if $p$, $q$, and $r$ use three different colors, then $v$ can be given $q$'s color, the left child of $v$ can be given $r$'s color, and the right child of $v$ can be given $p$'s color.

• In the remaining base case, $T$ has exactly two internal nodes, each adjacent to two leaves. The graph is the graph of a triangular cylinder, which can be three-colored.

Incidentally, if $T$ has no degree two vertices, then $G(T)$ is called a Halin graph; with or without the degree two restriction, it has bounded treewidth, so an alternative method for finding an optimal coloring in linear time is to use dynamic programming. However, this method does not tell you ahead of time which trees require only three colors.

• That's the point. I want to prove that $G(T)$ is 3-colorable if $T\neq K_{1,2r+1}$. – user15735 Apr 21 '13 at 16:15
• Ok, I expanded my answer to include a proof of that. – David Eppstein Apr 21 '13 at 22:26

The proof I posted here (and at MathOverflow) yesterday is flawed. Here is a corrected version:

As nvcleemp noted (at MathOveflow), one should start with a 2-coloring (Black and White) of the tree and, if the number of leaves is even, simply change every other leaf around the cycle to a third color (Red). It's only if there is an odd number leaves that we have to do something fancier. To handle that case, it's helpful to introduce a tiny bit of terminology: Let's call the vertices that leaves are connected to "buds."

If the tree is not a star, then there are at least two buds for which the cycle traversing the leaves passes consecutively through those buds' leaves.

Proof:

It's easy to see that this is true if there are only two buds. The rest is by induction, which is easiest to picture if you imagine the graph deformed so that the cycle through the leaves is a circle. Suppose there's a bud for which the cycle does not pass consecutively through its leaves. Picture that bud as being at the center of the circle and two of its non-consecutive leaves at 12:00 and 6:00 on the circle, connected to the bud by radii. The non-consecutiveness means there are other buds connecting to other leaves on each side of the diameter just drawn. This means there is a smaller tree on each side (including the bud and two leaves of the diameter), so induction applies. One of the two consecutive-leaf buds for each side may be the bud at the center of the circle, but that still leaves at least one bud on each side for which the cycle passes through its leaves consecutively.

We're now in position to complete the proof of 3-coloring for non-stars in the case of oddly many leaves.

Pick one of the buds for which the cycle passes consecutively through its leaves. (The lemma guarantees us two, but we only need one.) Change its color to Red. Skipping its leaves for the moment, and starting with the "next" leaf (say running clockwise), turn every other leaf Red until you get back around to the Red bud's leaves, at which point you just need to alternate Black and White. (Note, this works even for the "easy" case where the number of leaves is even.)

May be one should be more specific about the construction of G(T) from T. Consider the following (counter)-example: E(T) = {(1,2), (1,3), (1,4)} and then you form G(T) by adding the edge-set: {(2,3), (3,4), (4,2)} then there is surely a planar-embedding of the graph but is not 3-colorable! I know I've been too generous (:) ) in the construction of G(T).

• your tree is the $K_{1, 2r+1}$! – user13136 Apr 21 '13 at 15:40
• yup my bad - thx for pointing out – Ram Apr 22 '13 at 7:37

Added 4/24/13: I tried replacing this incorrect proof with a correct one yesterday, but for some reason was unable to do so, so I posted the correction separately. There is no reason to read any further here, except perhaps for the link to mathoverflow. [end of addition]

I posted the following proof at https://mathoverflow.net/questions/128169/3-coloring-of-specific-planar-graphs where the problem was cross posted (as fidbc noted in comments here and there):

Let's call the vertices that leaves are connected to "buds." Note that the cycle traversing the leaves must pass consecutively through the leaves of each bud. This makes everything easy.

As in nvcleemp's answer, start with a 2-coloring (Black and White) of the tree. If the number of leaves is even, there's no problem changing every other one to a third color (Red). If the number of leaves is odd and the tree is not a star, there are two possibilities: either one of the buds has an even number of leaves, or all the buds have an odd number of leaves and there are an odd number of them (and that number is at least 3).

The case where there's a bud with an even number of leaves is easy to handle: Take the portion of the cycle that doesn't contain that bud's leaves, note that it is a path connecting an odd number of leaves (since odd minus even is odd), and change every other leaf's color to Red, starting with the first and hence stopping with the last. Finally, change the selected bud's color to Red and alternate its leaves Black and White.

The case where there are an odd number of buds, each with an odd number of leaves, is a little trickier. For the moment, retract all the leaves down to their buds, dragging the cycle with them. Some of the edges of this "retraction" cycle might coincide with edges connecting buds of the underlying tree, but they can't all coincide -- there must be at least two "consecutive" buds on the retraction cycle that are not in fact connected. (This is where non-starness is assumed.) Now color these two buds Red. Finally, undo the retraction of the original cycle's leaves and, starting with the first first leaf of the first non-Red bud, color every other leaf Red. Since there's an odd number of buds each with an odd number of leaves, this changes the last leaf of the last non-Red bud to Red, leaving only the leaves of the two Red buds, which can be colored alternately Black and White.