code: def _minimum_spanning_tree_subgraph(G):
      mst_subgraph = Graph()
      if G.is_directed():
          raise ValueError("input graph must be undirected")
      mst_df = minimum_spanning_tree_wrapper.minimum_spanning_tree(G)
      if G.renumbered:
          mst_df = G.unrenumber(mst_df, "src")
          mst_df = G.unrenumber(mst_df, "dst")
  
      mst_subgraph.from_cudf_edgelist(
          mst_df, source="src", destination="dst", edge_attr="weight"
      )
      return mst_subgraph
  
imports: from cugraph.tree import minimum_spanning_tree_wrapper
  from cugraph.structure.graph_classes import Graph
  from cugraph.utilities import ensure_cugraph_obj_for_nx, cugraph_to_nx
label_desc: Use image node_id 1 for calling a global function with example usage: _minimum_spanning_tree_subgraph(G) and returns: mst_subgraph