def copy(self):
        """Return a shallow copy of this graph.
        """
        other = DirectedGraph()
        other._vertices = set(self._vertices)
        other._forwards = {k: set(v) for k, v in self._forwards.items()}
        other._backwards = {k: set(v) for k, v in self._backwards.items()}
        return other
def copy ( self ) : other = DirectedGraph ( ) other . _vertices = set ( self . _vertices ) other . _forwards = { k : set ( v ) for k , v in self . _forwards . items ( ) } other . _backwards = { k : set ( v ) for k , v in self . _backwards . items ( ) } return other
Return a shallow copy of this graph.