NetworkX

Previous topic

get_edge_attributes

Next topic

is_frozen

freeze

freeze(G)[source]

Modify graph to prevent addition of nodes or edges.

Parameters :

G : graph

A NetworkX graph

See also

is_frozen

Notes

This does not prevent modification of edge data.

To “unfreeze” a graph you must make a copy.

Examples

>>> G=nx.Graph()
>>> G.add_path([0,1,2,3])
>>> G=nx.freeze(G)
>>> try:
...    G.add_edge(4,5)
... except nx.NetworkXError as e:
...    print(str(e))
Frozen graph can't be modified