class_docstr: Represent a single graph with additional attributes.
class_docstr_tok: ["Represent","a","single","graph","with","additional","attributes","."]
docstr: Add a bunch of edges to the graph.
  
  Parameters
  ----------
  src : int or list
      Source node indices
  tgt : int or list
      Target node indices
  
  Raises
  ------
  ValueError
      If the lengths of `src` and `tgt` don't match or one of the list contains no element.
code: def add_edges(
      self, src: Union[int, List[int]], tgt: Union[int, List[int]]
  ) -> None:
      """
      Add a bunch of edges to the graph.
  
      Parameters
      ----------
      src : int or list
          Source node indices
      tgt : int or list
          Target node indices
  
      Raises
      ------
      ValueError
          If the lengths of `src` and `tgt` don't match or one of the list contains no element.
      """
      src, tgt = check_and_expand(int_to_list(src), int_to_list(tgt))
      if len(src) != len(tgt):
          raise ValueError(
              "Length of the source and target indices is not the same. "
              "Got {} source nodes and {} target nodes".format(
                  len(src), len(tgt)
              )
          )
      for src_idx, tgt_idx in zip(src, tgt):
          # Consistency check
          if (src_idx < 0 or src_idx >= self.get_node_num()) and (
              tgt_idx < 0 and tgt_idx >= self.get_node_num()
          ):
              raise ValueError("Endpoint not in the graph.")
  
      current_num_edges = len(self._edge_attributes)
      duplicate_edge_indices = list()
      for i in range(len(src)):
          # Duplicate edge check.
          # If the edge to be added already exists in the graph, then skip it.
          endpoint_tuple = (src[i], tgt[i])
          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,
                  )
              duplicate_edge_indices.append(i)
              continue
          self._nids_eid_mapping[endpoint_tuple] = current_num_edges + i
  
      # Remove duplicate edges
      # Needs to be reversed first to avoid index overflow after popping.
      duplicate_edge_indices.reverse()
      for edge_index in duplicate_edge_indices:
          src.pop(edge_index)
          tgt.pop(edge_index)
  
      num_edges = len(src)
  
      # Add edge indices
      self._edge_indices.src.extend(src)
      self._edge_indices.tgt.extend(tgt)
  
      # Initialize edge attributes and features
      self._edge_attributes.extend(
          [
              single_edge_attr_factory(**res_init_edge_attributes)
              for _ in range(num_edges)
          ]
      )
      for key in self._edge_features.keys():
          self._edge_features[key] = entail_zero_padding(
              self._edge_features[key], num_edges
          )
  
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 15 for calling the GraphData obj's underlying member method code with example usage: obj.add_edges(src, tgt) without return types