@Test public void permute() {

    Graph g = new Graph(2);
    g.addAtom(mock(Atom.class));
    g.addAtom(mock(Atom.class));
    g.addAtom(mock(Atom.class));
    g.addAtom(mock(Atom.class));
    g.addEdge(new Edge(0, 1, Bond.IMPLICIT));
    g.addEdge(new Edge(1, 2, Bond.IMPLICIT));
    g.addEdge(new Edge(2, 3, Bond.IMPLICIT));
    assertThat(g.degree(0), is(1));
    assertThat(g.degree(1), is(2));
    assertThat(g.degree(2), is(2));
    assertThat(g.degree(3), is(1));
    Graph h = g.permute(new int[]{1, 0, 3, 2});
    assertThat(h.degree(0), is(2));
    assertThat(h.degree(1), is(1));
    assertThat(h.degree(2), is(1));
    assertThat(h.degree(3), is(2));
    assertThat(g.atom(0), is(h.atom(1)));
    assertThat(g.atom(1), is(h.atom(0)));
    assertThat(g.atom(2), is(h.atom(3)));
    assertThat(g.atom(3), is(h.atom(2)));
}