code: def from_dgl(g: dgl.DGLGraph) -> GraphData:
      """
      Convert a dgl.DGLGraph to a GraphData object.
  
      Parameters
      ----------
      g : dgl.DGLGraph
          The source graph in DGLGraph format.
  
      Returns
      -------
      GraphData
          The converted graph in GraphData format.
      """
      graph = GraphData()
      graph.from_dgl(g)
      return graph
  
imports: import os
  import warnings
  from collections import namedtuple
  from typing import Any, Callable, Dict, List, Tuple, Union
  import dgl
  import scipy.sparse
  import torch
  from torch.nn.utils.rnn import pad_sequence
  from .utils import EdgeNotFoundException, SizeMismatchException, check_and_expand, entail_zero_padding, int_to_list, slice_to_list
  from .views import BatchEdgeFeatView, BatchNodeFeatView, EdgeView, NodeFeatView, NodeView
label_desc: Use image node_id 1 for calling a global function with example usage: from_dgl(g) and returns: graph