code: def convert_weighted_named_to_gdf(NX_G, weight, vertex_type="int32"):
      _edges = NX_G.edges(data=weight)
  
      src = [s for s, _, _ in _edges]
      dst = [d for _, d, _ in _edges]
      wt = [w for _, _, w in _edges]
  
      _gdf = cudf.DataFrame()
      _gdf["src"] = cudf.Series(src)
      _gdf["dst"] = cudf.Series(dst)
      _gdf["weight"] = wt
  
      if is_integer_dtype(_gdf["src"]) or is_integer_dtype(_gdf["dst"]):
          _gdf = _gdf.astype({"src": vertex_type, "dst": vertex_type})
  
      # FIXME: The weight dtype is hardcoded.
      _gdf = _gdf.astype({"weight": "float32"})
  
      return _gdf
  
file_path: cugraph/python/cugraph/cugraph/utilities/nx_factory.py
imports: import cugraph
  from .utils import import_optional
  import cudf
  from cudf import from_pandas
  from cudf.api.types import is_integer_dtype
label_desc: Use image node_id 2 for calling a global function with example usage: convert_weighted_named_to_gdf(NX_G, weight, vertex_type) and returns: _gdf