private Pair<Integer,Integer> indexToEdgeBijection(long index){
  long i=(long)Math.ceil((Math.sqrt(1 + 8 * (index + 1)) - 1) / 2);
  long diff=index + 1 - (i * (i - 1)) / 2;
  return Pair.of((int)i,(int)diff - 1);
}

private Pair < Integer , Integer > indexToEdgeBijection ( long index ) { long i = ( long ) Math . ceil ( ( Math . sqrt ( 1 + 8 * ( index + 1 ) ) - 1 ) / 2 ) ; long diff = index + 1 - ( i * ( i - 1 ) ) / 2 ; return Pair . of ( ( int ) i , ( int ) diff - 1 ) ; }
maps an index in a hypothetical list of all edges to the actual edge .
