Add doc and minor simplification to buildAdjacencyGraph()