In *vertex coloring*, we seek to assign a color to each vertex
of a graph *G*
such that no edge links two vertices of the same color.
We can avoid all conflicts by assigning each vertex
its own color.
However, the goal is to use as few colors as possible.
Vertex coloring problems arise often in scheduling applications,
such as register allocation in compilers.
See Section for a full treatment of
vertex coloring algorithms and applications.

A graph is *bipartite* if it can be colored without conflicts while using
only two colors.
Bipartite graphs are important because they arise often in practice
and have
more structure than arbitrary graphs.
For example, consider the ``had-sex-with'' graph in a heterosexual world.
Men have sex only with women, and vice versa.
Thus gender defines a legal two-coloring.
Irrespective of the accuracy of the model, it should be clear that
bipartite graphs are simpler to work with than general graphs.

But how can we find an appropriate two-coloring of a graph, thus separating the men from the women? Suppose we assume that the starting vertex is male. All vertices adjacent to this man must be female, assuming the graph is indeed bipartite.

We can augment either breadth-first or depth-first search so that whenever we discover a new vertex, we color it the opposite of its parent. For each non-discovery edge, we check whether it links two vertices of the same color. Such a conflict means that the graph cannot be two-colored. However, we will have constructed a proper two-coloring whenever we terminate without conflict. We can assign the first vertex in any connected component to be whatever color/sex we wish. Although we can separate the men from the women, we can't tell them apart just using the graph.

Mon Jun 2 23:33:50 EDT 1997