implemented calcIndex() and getAdjList()