@classmethod
def copy(cls, graph):
    """Copy the input graph object."""
    new_graph = cls()
    new_graph.add_nodes_from(graph.nodes(data=True))
    new_graph.add_edges_from(graph.edges(data=True))
    return new_graph
