![]() ![]() visited = True # Check if there is an outgoing edge for a node in the adjacency list if src in self. # The default dictionary would create an empty list as a default (value) # for the nonexistent keys.ĭef AddEdge(self, src : int, dst : int) : ‘V’ is the number of vertices and ‘E’ is the number of edges in a graph.įrom collections import deque, defaultdict Time complexity of topological sort : O ( V + E ) for an adjacency list implementation of a graph.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |