replace some code that depends on the changed code related to
AdjacencyMatrix