Big O in Adjency List - remove vertex and remove edge(time complexity cost of performing various operations on graphs)
问题 I have to prepare explanation of time complexity of removing vertex ( O(|V| + |E|) ) and edge ( O(|E|) ) in Adjency List. When removing vertex from graph with V vertices and E edges we need to go through all the edges ( O(|E|) ), of course, to check if which ones need to be removed with the vertex, but why do we need to check all vertices ? I don't understand why in order to remove edge we need to go through all the edges. I think I might have bad understanding from the beginning, so would