Proving any N x M undirected two dimensional grid is bipartite

2.7k Views Asked by At

I am trying to self learn graph theory basics by myself, and it would be really helpful is somebody could double check one of my answers:

Let $N$ and $M$ be positive integers. Show that any $N$ x $M$ $2$-dimensional undirected grid is bipartite.

My answer was this:

Let $i, j \in {Z}^+$ such that $0<i =< N $ and $0< j=< M$. Then $v_{i,j}$ would correspond to the vertex in the $i$th row and $j$th column. Consider the case where $i$ is even and $j$ is odd. Color all the vertices with color $c_1$. Now consider $i$ odd and $j$ even. Color $v_{i,j}$ with color $c_2$. Since none of the same colored vertices touch each other (we assume there are no diagonal edges between vertices), and we know any 2-colorable graph is bipartite, we conclude any $N$ x $ M$ 2-d undirected grid is bipartite.

I'm pretty sure it is correct, but would greatly appreciate any input. If you think of other way of doing it I welcome the input as well.

1

There are 1 best solutions below

1
On

Many thanks to Thomas Belulovich for pointing out that not all vertices had been colored on my first try. My final answer is this:

Let $i,j∈Z^+$ such that $0<i=<N$ and $0<j=<M$. Then $v_{i,j}$ would correspond to the vertex in the $i$th row and $j$th column.

Consider the case where $i$ is even: If $j$ is odd, color the vertices with color $c_1$; if $j$ is even, color the vertices with $c_2$. Now consider $i$ odd. If $j$ is even, color $v_{i,j}$ with color $c_1$: if $j$ is odd, color the vertices with color $c_ 2$. Since none of the same colored vertices touch each other (we assume there are no diagonal edges between vertices), and we know any 2-colorable graph is bipartite, we conclude any $N$ x $M$ 2-d undirected grid is bipartite.