code: def collapse_nodes_and_edges(
      g: Plottable, parent: Union[str, int], child: Union[str, int]
  ):
      """
          Asserts that parent and child node in ndf should be collapsed into super node.
          Sets new ndf with COLLAPSE nodes in graphistry instance g
  
          # this asserts that we SHOULD merge parent and child as super node
          # outside logic controls when that is the case
          # for example, it assumes parent is already in cluster keys of COLLAPSE node
  
      :param g: graphistry instance
      :param parent: `node` with `attribute` in `column`
      :param child: `node` with `attribute` in `column`
      :returns: graphistry instance
      """
  
      ndf, edf, src, dst, node = unpack(g)
  
      new_parent_name = get_new_node_name(ndf, parent, child)
  
      ndf.loc[ndf[node] == parent, COLLAPSE_NODE] = new_parent_name
      ndf.loc[ndf[node] == child, COLLAPSE_NODE] = new_parent_name
  
      edf.loc[edf[src] == parent, COLLAPSE_SRC] = new_parent_name
      edf.loc[edf[dst] == parent, COLLAPSE_DST] = new_parent_name
  
      edf.loc[edf[src] == child, COLLAPSE_SRC] = new_parent_name
      edf.loc[edf[dst] == child, COLLAPSE_DST] = new_parent_name
  
      g._edges = edf
      g._nodes = ndf
  
imports: from typing import Union, Optional, List
  import copy, logging, pandas, numpy
  from graphistry.PlotterBase import Plottable
label_desc: Use image node_id 14 for calling a global function with example usage: collapse_nodes_and_edges(g, parent, child) without return types