code: def freeze(G):
      """Modify graph to prevent further change by adding or removing
      nodes or edges.
  
      Node and edge data can still be modified.
  
      Parameters
      ----------
      G : graph
        A NetworkX graph
  
      Examples
      --------
      >>> G = nx.path_graph(4)
      >>> G = nx.freeze(G)
      >>> try:
      ...     G.add_edge(4, 5)
      ... except nx.NetworkXError as err:
      ...     print(str(err))
      Frozen graph can't be modified
  
      Notes
      -----
      To "unfreeze" a graph you must make a copy by creating a new graph object:
  
      >>> graph = nx.path_graph(4)
      >>> frozen_graph = nx.freeze(graph)
      >>> unfrozen_graph = nx.Graph(frozen_graph)
      >>> nx.is_frozen(unfrozen_graph)
      False
  
      See Also
      --------
      is_frozen
      """
      G.add_node = frozen
      G.add_nodes_from = frozen
      G.remove_node = frozen
      G.remove_nodes_from = frozen
      G.add_edge = frozen
      G.add_edges_from = frozen
      G.add_weighted_edges_from = frozen
      G.remove_edge = frozen
      G.remove_edges_from = frozen
      G.clear = frozen
      G.clear_edges = frozen
      G.frozen = True
      return G
  
imports: from collections import Counter
  from itertools import chain
  import networkx
  from networkx.utils import not_implemented_for, pairwise
label_desc: Use image node_id 11 for calling a global function with example usage: freeze(G) and returns: G