replace the problematic AdjacencyMatrix