private void compareIndexedGraphs(Graph<Number,Number> g1,Graph<Number,Number> g2){
  int n1=g1.getVertexCount();
  int n2=g2.getVertexCount();
  assertEquals(n1,n2);
  assertEquals(g1.getEdgeCount(),g2.getEdgeCount());
  List<Number> id1=new ArrayList<Number>(g1.getVertices());
  List<Number> id2=new ArrayList<Number>(g2.getVertices());
  for (int i=0; i < n1; i++) {
    Number v1=id1.get(i);
    Number v2=id2.get(i);
    assertNotNull(v1);
    assertNotNull(v2);
    checkSets(g1.getPredecessors(v1),g2.getPredecessors(v2),id1,id2);
    checkSets(g1.getSuccessors(v1),g2.getSuccessors(v2),id1,id2);
  }
}

private void compareIndexedGraphs ( Graph < Number , Number > g1 , Graph < Number , Number > g2 ) { int n1 = g1 . getVertexCount ( ) ; int n2 = g2 . getVertexCount ( ) ; assertEquals ( n1 , n2 ) ; assertEquals ( g1 . getEdgeCount ( ) , g2 . getEdgeCount ( ) ) ; List < Number > id1 = new ArrayList < Number > ( g1 . getVertices ( ) ) ; List < Number > id2 = new ArrayList < Number > ( g2 . getVertices ( ) ) ; for ( int i = 0 ; i < n1 ; i ++ ) { Number v1 = id1 . get ( i ) ; Number v2 = id2 . get ( i ) ; assertNotNull ( v1 ) ; assertNotNull ( v2 ) ; checkSets ( g1 . getPredecessors ( v1 ) , g2 . getPredecessors ( v2 ) , id1 , id2 ) ; checkSets ( g1 . getSuccessors ( v1 ) , g2 . getSuccessors ( v2 ) , id1 , id2 ) ; } }
tests to see whether these two graphs are structurally equivalent , based on the connectivity of the vertices with matching indices in each graph . assumes a 0 - based index .
