code: def _compare_graphs(nxG, cuG, has_wt=True):
      assert nxG.number_of_nodes() == cuG.number_of_nodes()
      assert nxG.number_of_edges() == cuG.number_of_edges()
  
      cu_df = cuG.view_edge_list().to_pandas()
      cu_df = cu_df.rename(columns={"0": "src", "1": "dst"})
      if has_wt is True:
          cu_df = cu_df.drop(columns=["weight"])
  
      out_of_order = cu_df[cu_df["src"] > cu_df["dst"]]
      if len(out_of_order) > 0:
          out_of_order = out_of_order.rename(
              columns={"src": "dst", "dst": "src"}
          )
          right_order = cu_df[cu_df["src"] < cu_df["dst"]]
          cu_df = pd.concat([out_of_order, right_order])
          del out_of_order
          del right_order
      cu_df = cu_df.sort_values(by=["src", "dst"]).reset_index(
          drop=True
      )
  
      nx_df = nx.to_pandas_edgelist(nxG)
      if has_wt is True:
          nx_df = nx_df.drop(columns=["weight"])
      nx_df = nx_df.rename(columns={"source": "src", "target": "dst"})
      nx_df = nx_df.astype("int32")
  
      out_of_order = nx_df[nx_df["src"] > nx_df["dst"]]
      if len(out_of_order) > 0:
          out_of_order = out_of_order.rename(
              columns={"src": "dst", "dst": "src"}
          )
          right_order = nx_df[nx_df["src"] < nx_df["dst"]]
  
          nx_df = pd.concat([out_of_order, right_order])
          del out_of_order
          del right_order
  
      nx_df = nx_df.sort_values(by=["src", "dst"]).reset_index(
          drop=True
      )
  
      assert cu_df.to_dict() == nx_df.to_dict()
  
file_path: cugraph/python/cugraph/cugraph/tests/nx/test_nx_convert.py
imports: import pytest
  import pandas
  import networkx
  import cudf
  import cugraph
  from cugraph.testing import utils, DEFAULT_DATASETS
label_desc: Use image node_id 1 for calling a global function with example usage: _compare_graphs(nxG, cuG, has_wt) without return types