@@ -0,0 +1,1530 @@
+package me.alivecode.algs4;%0A%0Aimport edu.princeton.cs.algs4.In;%0Aimport edu.princeton.cs.algs4.StdOut;%0A%0A/**%0A * The %7B@code Bipartite%7D class represents a data type for%0A * determining if the specified graph is bipartite.%0A */%0Apublic class Bipartite %7B%0A    private boolean%5B%5D marked;%0A    private boolean%5B%5D color;%0A    private boolean isBipartite;%0A%0A    /**%0A     * Computes if the specified graph is bipartite.%0A     *%0A     * @param G the specified graph.%0A     */%0A    public Bipartite(Graph G) %7B%0A        marked = new boolean%5BG.V()%5D;%0A        color = new boolean%5BG.V()%5D;%0A        isBipartite = true;%0A%0A        for(int v = 0; v %3C G.V(); v++) %7B%0A            if (!marked%5Bv%5D) %7B%0A                dfs(G, v);%0A            %7D%0A        %7D%0A    %7D%0A%0A    private void dfs(Graph G, int v) %7B%0A        marked%5Bv%5D = true;%0A%0A        for(int w : G.adj(v)) %7B%0A            if (!marked%5Bw%5D) %7B%0A                color%5Bw%5D = !color%5Bv%5D;%0A                dfs(G, w);%0A            %7D%0A            else if(color%5Bw%5D == color%5Bv%5D) %7B%0A                isBipartite = false;%0A            %7D%0A        %7D%0A    %7D%0A%0A    /**%0A     * Is the specified bipartite?%0A     *%0A     * @return %7B@code true%7D if the specified is bipartite, %7B@code false%7D otherwise.%0A     */%0A    public boolean isBipartite() %7B%0A        return isBipartite;%0A    %7D%0A%0A    // unit test code.%0A    public static void main(String%5B%5D args) %7B%0A        In in = new In(args%5B0%5D);%0A        Graph G = new Graph(in);%0A        Bipartite bp = new Bipartite(G);%0A        StdOut.println(%22The specified graph is%22 + (bp.isBipartite() ? %22 %22 : %22 not %22) + %22bipartite.%22);%0A    %7D%0A%7D%0A

Add Bipartite class, a data type for determining if the specified graph is bipartite.