def remove_edge(self,eid): if not self.has_edge(eid) : raise InvalidEdge(eid) sid,tid=self._edges[eid] self._vertices[sid][1].remove(eid) self._vertices[tid][0].remove(eid) del self._edges[eid]
def remove_edge(self, eid): if not self.has_edge(eid): raise InvalidEdge(eid) vs, vt = self._edges[eid] self._vertices[vs][1].remove(eid) self._vertices[vt][0].remove(eid) del self._edges[eid] self._eid_generator.release_id(eid)
def target(self, eid): try: return self._edges[eid][1] except KeyError: raise InvalidEdge(eid)
def source(self, eid): try: return self._edges[eid][0] except KeyError: raise InvalidEdge(eid)
def edge_vertices(self, eid): try : return self._edges[eid] except KeyError : raise InvalidEdge(eid)