code: def pandas_to_dgl_graph(
      df: pd.DataFrame,
      src: str,
      dst: str,
      weight_col: Optional[str] = None,
      device: str = "cpu",
  ) -> Tuple["dgl.DGLGraph", "scipy.sparse.coo_matrix", Dict]:
      """Turns an edge DataFrame with named src and dst nodes, to DGL graph
      :eg
          g, sp_mat, ordered_nodes_dict = pandas_to_sparse_adjacency(df, 'to_node', 'from_node')
      :param df: DataFrame with source and destination and optionally weight column
      :param src: source column of DataFrame for coo matrix
      :param dst: destination column of DataFrame for coo matrix
      :param weight_col: optional weight column when constructing coo matrix
      :param device: whether to put dgl graph on cpu or gpu
      :return
          g: dgl graph
          sp_mat: sparse scipy matrix
          ordered_nodes_dict: dict ordered from most common src and dst nodes
      """
      _, _, dgl = lazy_dgl_import_has_dependency()  # noqa: F811
      sp_mat, ordered_nodes_dict = pandas_to_sparse_adjacency(
          df, src, dst, weight_col
      )
      g = dgl.from_scipy(
          sp_mat, device=device
      )  # there are other ways too
      logger.info(f"Graph Type: {type(g)}")
  
      return g, sp_mat, ordered_nodes_dict
  
imports: from collections import Counter
  from typing import Dict, Optional, TYPE_CHECKING, Tuple
  import numpy
  import pandas
  from .None import constants
  from .feature_utils import FeatureEngine, FeatureMixin, resolve_feature_engine, XSymbolic, YSymbolic, resolve_X, resolve_y
  from .util import setup_logger
label_desc: Use image node_id 7 for calling a global function with example usage: pandas_to_dgl_graph(df, src, dst, weight_col, device) and returns: g,  sp_mat,  ordered_nodes_dict