Low Level Design, Object Oriented, Graph Data Structure, Hashmap, Interview Questions.
set(dstNodes): # Delete all edges first self.deleteEdge(node, dstNode) self.deleteEdge(dstNode, node) # If node is "orphan" then recursively delete that node if len(self.adj_list[dstNode.uid]) == 0 and \ len(self.parents[dstNode.uid]) == 0: self.deleteNode(dstNode) # Delete all parent edges and