Fixed performance issues in AdjacencyGraph