Gallai–Hasse–Roy–Vitaver theorem
# Gallai–Hasse–Roy–Vitaver theorem

In graph theory, the Gallai–Hasse–Roy–Vitaver theorem is a form of duality between the colorings of the vertices of a given undirected graph and the orientations of its edges. It states that the minimum number of colors needed to properly color any graph $G$ equals one plus the length of a longest path in an orientation of $G$ chosen to minimize this path's length. The orientations for which the longest path has minimum length always include at least one acyclic orientation.

This theorem implies that every orientation of a graph with chromatic number $k$ contains a simple directed path with $k$ vertices; this path can be constrained to begin at any vertex that can reach all other vertices of the oriented graph.

## Examples

A bipartite graph may be oriented from one side of the bipartition to the other. The longest path in this orientation has length one, with only two vertices. Conversely, if a graph is oriented without any three-vertex paths, then every vertex must either be a source (with no incoming edges) or a sink (with no outgoing edges) and the partition of the vertices into sources and sinks shows that it is bipartite.

In any orientation of a cycle graph of odd length, it is not possible for the edges to alternate in orientation all around the cycle, so some two consecutive edges must form a path with three vertices. Correspondingly, the chromatic number of an odd cycle is three.

## Proof

To prove that the chromatic number is greater than or equal to the minimum number of vertices in a longest path, suppose that a given graph has a coloring with $k$ colors, for some number $k$. Then it may be acyclically oriented by numbering colors and by directing each edge from its lower-numbered endpoint to the higher-numbered endpoint. With this orientation, the numbers are strictly increasing along each directed path, so each path can include at most one vertex of each color, for a total of at most $k$ vertices per path.

To prove that the chromatic number is less than or equal to the minimum number of vertices in a longest path, suppose that a given graph has an orientation with at most $k$ vertices per simple directed path, for some number $k$. Then the vertices of the graph may be colored with $k$ colors by choosing a maximal acyclic subgraph of the orientation, and then coloring each vertex by the length of the longest path in the chosen subgraph that ends at that vertex. Each edge within the subgraph is oriented from a vertex with a lower number to a vertex with a higher number, and is therefore properly colored. For each edge that is not in the subgraph, there must exist a directed path within the subgraph connecting the same two vertices in the opposite direction, for otherwise the edge could have been included in the chosen subgraph; therefore, the edge is oriented from a higher number to a lower number and is again properly colored.

The proof of this theorem was used as a test case for a formalization of mathematical induction by Yuri Matiyasevich.

## Category-theoretic interpretation

The theorem also has a natural interpretation in the category of directed graphs and graph homomorphisms. A homomorphism is a map from the vertices of one graph to the vertices of another that always maps edges to edges. Thus, a $k$-coloring of an undirected graph $G$ may be described by a homomorphism from $G$ to the complete graph $K_{k}$. If the complete graph is given an orientation, it becomes a tournament, and the orientation can be lifted back across the homomorphism to give an orientation of $G$. In particular, the coloring given by the length of the longest incoming path corresponds in this way to a homomorphism to a transitive tournament (an acyclically oriented complete graph), and every coloring can be described by a homomorphism to a transitive tournament in this way.

Considering homomorphisms in the other direction, to $G$ instead of from $G$, a directed graph $G$ has at most $k$ vertices in its longest path if and only if there is no homomorphism from the path graph $P_{k+1}$ to $G$.

Thus, the Gallai–Hasse–Roy–Vitaver theorem can be equivalently stated as follows:

   For every directed graph $G$, there is a homomorphism from $G$ to the $k$-vertex transitive tournament if and only if there is no homomorphism from the $(k+1)$-vertex path to $G$.

In the case that $G$ is acyclic, this can also be seen as a form of Mirsky's theorem that the longest chain in a partially ordered set equals the minimum number of antichains into which the set may be partitioned. This statement can be generalized from paths to other directed graphs: for every polytree $P$ there is a dual directed graph $D$ such that, for every directed graph $G$, there is a homomorphism from $G$ to $D$ if and only if there is not a homomorphism from $P$ to $G$.

## History and related results

The Gallai–Hasse–Roy–Vitaver theorem has been repeatedly rediscovered. It is named after separate publications by Tibor Gallai, Maria Hasse, B. Roy, and L. M. Vitaver. Roy credits the statement of the theorem to a conjecture in a 1958 graph theory textbook by Claude Berge. It is a generalization of a much older theorem of László Rédei from 1934, that every tournament (an oriented complete graph) contains a directed Hamiltonian path. Rédei's theorem follows immediately from the Gallai–Hasse–Roy–Vitaver theorem applied to an undirected complete graph.

Instead of orienting a graph to minimize the length of its longest path, it is also natural to maximize the length of the shortest path, for a strong orientation (one in which every pair of vertices has a shortest path). Having a strong orientation requires that the given undirected graph be a bridgeless graph. For these graphs, it is always possible to find a strong orientation in which, for some pair of vertices, the shortest path length equals the length of the longest path in the given undirected graph.

