code: def add_edge(self, u, v, **attr):
          
          if u not in self.vertices:
              self.vertices[u] = []
              self.pred[u] = []
              self.succ[u] = []
          if v not in self.vertices:
              self.vertices[v] = []
              self.pred[v] = []
              self.succ[v] = []
          vertex = (u, v)
          self.edges[vertex] = {}
          self.edges[vertex].update(attr)
          self.vertices[u].append(v)
          self.pred[v].append(u)
          self.succ[u].append(v)
docs: Add an edge from u to v and update edge attributes