Implemented calcAdjacencies.