Low Level Design, Object Oriented, Graph Data Structure, Hashmap, Interview Questions.
{} def addEdge(self, srcNode:Node, dstNode:Node, sortKey:str=None): # Add an edge b/w 2 nodes if srcNode.uid not in self.adj_list: self.adj_list[srcNode.uid] = {} if dstNode.type not in self.adj_list[srcNode.uid]: if sortKey: # Add node with ordering enabled self.adj_list[srcNode.uid][dstNode.type]