The kingdom of Pinguinia has various cities and streets, the latter being all one-way streets always run between exactly two cities, so there are no intermediate stops. Every city has exactly two streets that lead out of it and exactly two that lead into it. Prove that the streets can be divided into black and white streets so that exactly one exit of each city is black and one is white and exactly one white and one black entrance in each city.
Problem 1599
Official solution
1. Graph Construction:
- Let be the set of cities.
- Construct a bipartite graph with vertex set .
- For each city , create two vertices: and .
- Draw an edge between and if there is a one-way street from city to city .
2. Degree of Vertices:
- Each city has exactly two streets leading out of it and exactly two streets leading into it.
- Therefore, each vertex in has degree 2.
3. Perfect Matching:
- By Hall's Marriage Theorem, a bipartite graph has a perfect matching if and only if for every subset of one part, the neighborhood of (denoted ) has at least as many vertices as .
- In our graph , since each vertex has degree 2, the conditions of Hall's Marriage Theorem are satisfied.
- Therefore, there exists a perfect matching in .
4. Coloring the Streets:
- The perfect matching in corresponds to a set of streets in the original graph.
- Color the streets in the perfect matching as black.
- The remaining streets (not in the perfect matching) are colored white.
5. Verification:
- Each city has exactly one black and one white street leading out of it:
- Since each vertex and is matched exactly once in the perfect matching, each city has exactly one black street leading out.
- The remaining street leading out of must be white.
- Each city has exactly one black and one white street leading into it:
- Similarly, each vertex and is matched exactly once in the perfect matching, so each city has exactly one black street leading in.
- The remaining street leading into must be white.
Thus, we have successfully divided the streets into black and white such that each city has exactly one black and one white street leading out and one black and one white street leading in.