Find out if Graph is isomorphic Java
<p>I need to check if a graph is Isomorphic by generating all permutation. I am using this permutation class and now I need to create a graph class that represents the graph as a 2D boolean array. An example would be the user entering in 2 graphs as strings </p>

<p><code>Ex."0-1 0-2 1-2 1-3 2-3" and "1-3 2-0 0-3 1-2 1-0"</code> </p>

<p>Now in my constrcutor I have to break it up and put it in a 2D boolean array. How would I go about doing that? </p>

<p>The user could also enter in something more complicated like "0-1 1-2 2-3 3-0 0-4 0-11 1-5 1-6 2-7 2-8 3-9 3-10 4-5 6-7 8-9 10-11 4-7 4-8 5-9 5-10 6-9 6-10 7-11 8-11"  and "0-1 1-2 2-3 3-0 0-4 0-7 1-4 1-5 2-5 2-6 3-6 3-7 4-8 4-9 5-9 5-10 6-10 6-11 7-8 7-11 8-9 9-10 10-11 11-8"</p>

<pre><code>public class PermutationGenerator
{
    // private data

    private int[] perm;
    private boolean first;

    // constructor

    public PermutationGenerator (int n)
    {
        perm = new int [n];
        first = true;
    }



    public int[] next ()
    {
        int n = perm.length;

        // starting permutation: 0 1 2 3 ... n-1

        if (first)
        {
            first = false;
            for (int i = 0 ; i &lt; n ; i++)
                perm [i] = i;
            return perm;
        }

        // construct the next permutation
        // find largest k so that perm[k] &lt; perm[k+1]; if none, finish

        int i, j, k, l;

        for (k = n - 2 ; k &gt;= 0 &amp;&amp; perm [k] &gt;= perm [k + 1] ; k--)
            ;
        if (k &lt; 0)
            return null; // no more

        // find largest l so that perm[k] &lt; perm[l]

        for (l = n - 1 ; l &gt;= 0 &amp;&amp; perm [k] &gt;= perm [l] ; l--)
            ;

        // swap perm[k] and perm[l]

        swap (perm, k, l);

        // reverse perm[k+1]...perm[n-1]

        for (i = k + 1, j = n - 1 ; i &lt; j ; i++, j--)
            swap (perm, i, j);

        return perm;
    }


    // swap a[i] and a[j]

    private static void swap (int a[], int i, int j)
    {
        int temp = a [i];
        a [i] = a [j];
        a [j] = temp;
    }
}
</code></pre>
