Remove adjacencyMatrix and degreeMatrix.