NetworkX

Previous topic

networkx.DiGraph.number_of_selfloops

Next topic

networkx.DiGraph.to_undirected

networkx.DiGraph.copy

DiGraph.copy()

Return a copy of the graph.

Returns:

G : Graph

A copy of the graph.

See also

to_directed
return a directed copy of the graph.

Notes

This makes a complete copy of the graph including all of the node or edge attributes.

Examples

>>> G = nx.Graph()   # or DiGraph, MultiGraph, MultiDiGraph, etc
>>> G.add_path([0,1,2,3])
>>> H = G.copy()