class_docstr: Represent a single graph with additional attributes.
class_docstr_tok: ["Represent","a","single","graph","with","additional","attributes","."]
docstr: Parameters
  ----------
  src: GraphData, default=None
      The source graph. If not None, then the newly generated graph
      is a copy of :py:class:`src`.
  device: str, default=None
      The device descriptor for graph. By default it is None.
code: def __init__(self, src=None, device: str = None):
      """
      Parameters
      ----------
      src: GraphData, default=None
          The source graph. If not None, then the newly generated graph
          is a copy of :py:class:`src`.
      device: str, default=None
          The device descriptor for graph. By default it is None.
      """
  
      # Initialize internal data storages.
      self._node_attributes = node_attribute_factory()
      self._node_features = node_feature_factory(res_init_node_features)
      self._edge_indices = EdgeIndex(src=[], tgt=[])
      self._nids_eid_mapping = nids_eid_mapping_factory()
      self._edge_features = edge_feature_factory(res_init_edge_features)
      self._edge_attributes = edge_attribute_factory()
      self.graph_attributes = graph_data_factory()
      self.device = device
  
      # Batch information.
      # If this instance is not a batch, then the following attributes are all `None`.
      self._is_batch = False  # Bool flag indicating whether this graph is a batch graph
      self.batch = None  # Batch node indices
      self.batch_size = None  # Batch size
      self._batch_num_nodes = None  # Subgraph node number list with the length of batch size
      self._batch_num_edges = None  # Subgraph edge number list with the length of batch size
  
      if src is not None:
          if isinstance(src, GraphData):
              self.from_graphdata(src)
          else:
              raise NotImplementedError
  
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 to create a new GraphData object from inherited base classes: object with example: obj = GraphData(src, device)