public boolean isBiparte(Graph<Integer> graph){
        
        Set<Vertex<Integer>> redSet = new HashSet<Vertex<Integer>>();
        Set<Vertex<Integer>> blueSet = new HashSet<Vertex<Integer>>();
        
        Queue<Vertex<Integer>> queue = new LinkedList<Vertex<Integer>>();
        
        for(Vertex<Integer> vertex : graph.getAllVertex()){
            if(!redSet.contains(vertex) && !blueSet.contains(vertex)){
                queue.add(vertex);
                redSet.add(vertex);
                while(!queue.isEmpty()){
                    vertex = queue.poll();
                    for(Vertex<Integer> v : vertex.getAdjacentVertexes()){
                        if(redSet.contains(vertex)){
                            if(redSet.contains(v)){
                                return false;
                            }if(blueSet.contains(v)){
                                continue;
                            }
                            blueSet.add(v);
                        }
                        else if(blueSet.contains(vertex)){
                            if(blueSet.contains(v)){
                                return false;
                            }if(redSet.contains(v)){
                                continue;
                            }
                            redSet.add(v);
                        }
                        queue.add(v);
                    }
                }
            }
        }
        System.out.println(redSet);
        System.out.println(blueSet);
        return true;
    }
http://www.geeksforgeeks.org/bipartite-graph/
 Includes both DFS and BFS method
src/com/interview/graph/BiparteGraph.java