Modified calcAdjacencies method