NetworkX

Previous topic

networkx.relabel_nodes

Next topic

networkx.is_frozen

networkx.freeze

freeze(G)

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.path_graph(4)
>>> G=nx.freeze(G)
>>> G.add_edge(4,5)
...
NetworkXError: Frozen graph can't be modified