Skip to main content
OlympiadHQ

Browse · MathNet

Print

Balkan Mathematical Olympiad Shortlisted Problems

counting and probability

Problem

A graph is good if its edges can be colored with 2 colors so that no cycle has two consecutive edges of the same color. What is the maximum number of edges in a good graph with 1000 vertices?

problem
Solution
We will prove the answer to be . First we prove that a good graph with vertices has at most edges.

Claim 1. If we have 3 paths going from vertex to vertex , then 2 of them have a common vertex different from , . Proof. Suppose not. By the Pigeonhole principle, observe that 2 of them have the same color attributed to 's edge in them. But if they have no other common points than and , they form a cycle where the 2 edges next to have the same color, contradiction. □

Claim 2. No edge lies in more than 1 cycle. Proof. Suppose edge lies in cycle and cycle . If and have no common vertices except and , observe that we can get from to from 3 disjoint paths: on , on and directly on edge , contradicting Claim 1. Thus, and have other common vertices. We can walk on going in the direction from to and suppose is the first such vertex we encounter. Then we have 3 disjoint paths from to : this path we just walked from to on , and the 2 paths given by , and all are disjoint by the way we chose , again contradicting Claim 1. □



Consider a connected and good graph with vertices and edges. It has a spanning tree containing edges, and every other edge then lies in a cycle where all other edges are edges of the tree, so no 2 such cycles coincide. However, by Claim 2, no two cycles share an edge, and from the statement, all have even lengths, thus at least 4. Furthermore, we have such cycles, so we have at least edges. This means , which gives . Now that we've proven the result for connected graphs, all we need to do for non-connected ones is to just apply it for all connected components and sum it up, yielding the result. We are left with providing the example for 1000 vertices: We have a vertex and 333 triplets with edges , , , , which can be colored alternatively. This is easily seen to work as these are the only cycles.

We will prove by mathematical induction that is the maximum number of edges for any . We can check the base cases for by hand. Assume the claim holds for all integers smaller than . Suppose that the claim does not hold for . Since the number of edges is larger than the graph contains a cycle. The cycle has to be of even length, as the consecutive edges must be of different colors. If 2 non-consecutive vertices of a cycle are connected, 2 additional cycles would exist, and it is clear that at least one of these would contain consecutive edges of the same color. Similarly, if there exists a path between 2 vertices belonging to the cycle using only edges that are not on the cycle, 2 additional cycles would exist, and one of them would have consecutive edges of the same color. Notice that if we replace the cycle by a vertex connected to a vertex outside the cycle if and only if one of the vertices in the cycle is connected to it, the condition would be true for the new graph. Let be the length of the cycle. Since the new graph has edges, by induction we know that it has at most edges. Our original graph thus has at most edges. Since for we get that the graph has at most which is contradiction, so the claim holds for .
Final answer
1332

Techniques

Graph TheoryColoring schemes, extremal argumentsPigeonhole principleInduction / smoothing