code: def _test_graph_collapse(self, g, g2):
      assert len(g._nodes) == len(
          g2._nodes
      )  # now we don't drop any since we write to FINAL columns instead. so nodes table will be same
      assert len(g._edges) >= len(g2._edges)
      assert (
          g2._nodes.astype(str).to_dict()
          == collapse_result_nodes_overwrite
      ), "collapsed nodes dataframe.astype(str) should match collapsed nodes df"
      assert (
          g._nodes.astype(str).to_dict()
          == parent_result_nodes_should_stay_same
      ), "original node dataframe.astype(str) should match parent ndf"
      assert (
          g2._edges.astype(str).to_dict()
          == collapse_result_edges_overwrite
      ), "collapsed edges dataframe.astype(str) should match collapsed edges df"
      assert (
          g._edges.astype(str).to_dict()
          == parent_result_edges_should_stay_same
      ), "original edge dataframe.astype(str) should match parent edf"
  
file_path: pygraphistry/graphistry/tests/test_compute_collapse.py
imports: import pandas
  from common import NoAuthTestCase
  from graphistry.tests.test_compute import CGFull
label_desc: Use image node_id 1 for calling the TestCollapse obj's underlying member method code with example usage: obj._test_graph_collapse(g, g2) without return types