class_docstr: Represent a single graph with additional attributes.
class_docstr_tok: ["Represent","a","single","graph","with","additional","attributes","."]
docstr: Add one edge to the graph.
  
  Parameters
  ----------
  src : int
      Source node index
  tgt : int
      Target node index
  
  Raises
  ------
  ValueError
      If one of the endpoints of the edge doesn't exist in the graph.
code: def add_edge(self, src: int, tgt: int):
      """
      Add one edge to the graph.
  
      Parameters
      ----------
      src : int
          Source node index
      tgt : int
          Target node index
  
      Raises
      ------
      ValueError
          If one of the endpoints of the edge doesn't exist in the graph.
      """
      # Consistency check
      if (src < 0 or src >= self.get_node_num()) and (
          tgt < 0 and tgt >= self.get_node_num()
      ):
          raise ValueError("Endpoint not in the graph.")
  
      # Duplicate edge check. If the edge to be added already exists in the graph, then skip it.
      endpoint_tuple = (src, tgt)
      if endpoint_tuple in self._nids_eid_mapping.keys():
          if log_level < 2:
              warnings.warn(
                  "Edge {} is already in the graph. Skipping this edge.".format(
                      endpoint_tuple
                  ),
                  Warning,
              )
          return
  
      # Append to the mapping list
      eid = self.get_edge_num()
      self._nids_eid_mapping[endpoint_tuple] = eid
  
      # Add edge
      self._edge_indices.src.append(src)
      self._edge_indices.tgt.append(tgt)
  
      # Initialize edge feature and attribute
      # 1. create placeholder in edge attribute dictionary
      self._edge_attributes.append(
          single_edge_attr_factory(**res_init_edge_attributes)
      )
      # 2. perform zero padding
      for key in self._edge_features.keys():
          self._edge_features[key] = entail_zero_padding(
              self._edge_features[key], 1
          )
  
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 14 for calling the GraphData obj's underlying member method code with example usage: obj.add_edge(src, tgt) without return types