private boolean isBiparteDFS(Vertex<Integer> vertex, Set<Vertex<Integer>> redSet, Set<Vertex<Integer>> blueSet,boolean wasRed){
    
        if(wasRed){
            if(redSet.contains(vertex)){
                return false;
            }
            else if(blueSet.contains(vertex)){
                return true;
            }
            blueSet.add(vertex);
        }

        else if(!wasRed){
            if(blueSet.contains(vertex)){
                return false;
            }
            if(redSet.contains(vertex)){
                return true;
            }
            redSet.add(vertex);
        }
        
        for(Vertex<Integer> adj : vertex.getAdjacentVertexes()){
            boolean flag = isBiparteDFS(adj, redSet, blueSet, !wasRed);
            if(!flag){
                return false;
            }
        }
        return true;
        
    }
http://www.geeksforgeeks.org/bipartite-graph/
 Includes both DFS and BFS method
src/com/interview/graph/BiparteGraph.java