@classmethod
def copy_from(cls, g):
    """Returns a new graph with the same nodes and edges.

        An error is returned if a directed instance is called from an
        undirected one.
        """
    return cls.build(g.edges, g.nodes)
