Feb. 21, 2014, 4:24 p.m. by Rosalind Team
Topics: Graphs
A bipartite graph is a graph
There are many other ways to formulate this property. For instance, an undirected graph is bipartite if and only if it can be colored with just two colors. Another one: an undirected graph is bipartite if and only if it contains no cycles of odd length.
Source: Algorithms by Dasgupta, Papadimitriou, Vazirani. McGraw-Hill. 2006.
Given: A positive integer
Return: For each graph, output "1" if it is bipartite and "-1" otherwise.
See Figure 1 for visual example from the sample dataset.
2 3 3 1 2 3 2 3 1 4 3 1 4 3 1 1 2
-1 1