code: def add_edges(g, u, v, data=None, etype=None):
      r"""Add the edges to the graph and return a new graph.
  
      The i-th new edge will be from ``u[i]`` to ``v[i]``.  The IDs of the new
      edges will start from ``g.num_edges(etype)``.
  
      Parameters
      ----------
      u : int, Tensor or iterable[int]
          Source node IDs, ``u[i]`` gives the source node for the i-th new edge.
      v : int, Tensor or iterable[int]
          Destination node IDs, ``v[i]`` gives the destination node for the i-th new edge.
      data : dict[str, Tensor], optional
          Feature data of the added edges. The keys are feature names
          while the values are feature data.
      etype : str or (str, str, str), optional
          The type names of the edges. The allowed type name formats are:
  
          * ``(str, str, str)`` for source node type, edge type and destination node type.
          * or one ``str`` edge type name if the name can uniquely identify a
            triplet format in the graph.
  
          Can be omitted if the graph has only one type of edges.
  
      Return
      ------
      DGLGraph
          The graph with newly added edges.
  
      Notes
      -----
      * If the end nodes of the given edges do not exist in :attr:`g`,
        :func:`dgl.add_nodes` is invoked to add those nodes.
        The node features of the new nodes will be filled with zeros.
      * For features in :attr:`g` but not in :attr:`data`,
        DGL assigns zero features for the newly added nodes.
      * For feature in :attr:`data` but not in :attr:`g`, DGL assigns zero features
        for the existing nodes in the graph.
      * This function discards the batch information. Please use
        :func:`dgl.DGLGraph.set_batch_num_nodes`
        and :func:`dgl.DGLGraph.set_batch_num_edges` on the transformed graph
        to maintain the information.
  
      Examples
      --------
      The following example uses PyTorch backend.
  
      >>> import dgl
      >>> import torch
  
      **Homogeneous Graphs**
  
      >>> g = dgl.graph((torch.tensor([0, 1]), torch.tensor([1, 2])))
      >>> g.num_edges()
      2
      >>> g = dgl.add_edges(g, torch.tensor([1, 3]), torch.tensor([0, 1]))
      >>> g.num_edges()
      4
  
      Since ``u`` or ``v`` contains a non-existing node ID, the nodes are
      added implicitly.
  
      >>> g.num_nodes()
      4
  
      If the graph has some edge features and new edges are added without
      features, their features will be filled with zeros.
  
      >>> g.edata['h'] = torch.ones(4, 1)
      >>> g = dgl.add_edges(g, torch.tensor([1]), torch.tensor([1]))
      >>> g.edata['h']
      tensor([[1.], [1.], [1.], [1.], [0.]])
  
      You can also assign features for the new edges in adding new edges.
  
      >>> g = dgl.add_edges(g, torch.tensor([0, 0]), torch.tensor([2, 2]),
      ...                   {'h': torch.tensor([[1.], [2.]]), 'w': torch.ones(2, 1)})
      >>> g.edata['h']
      tensor([[1.], [1.], [1.], [1.], [0.], [1.], [2.]])
  
      Since :attr:`data` contains new feature fields, the features for old edges
      will be filled with zeros.
  
      >>> g.edata['w']
      tensor([[0.], [0.], [0.], [0.], [0.], [1.], [1.]])
  
      **Heterogeneous Graphs**
  
      >>> g = dgl.heterograph({
      ...     ('user', 'plays', 'game'): (torch.tensor([0, 1, 1, 2]),
      ...                                 torch.tensor([0, 0, 1, 1])),
      ...     ('developer', 'develops', 'game'): (torch.tensor([0, 1]),
      ...                                         torch.tensor([0, 1]))
      ...     })
      >>> g.num_edges('plays')
      4
      >>> g = dgl.add_edges(g, torch.tensor([3]), torch.tensor([3]), etype='plays')
      >>> g.num_edges('plays')
      5
  
      See Also
      --------
      add_nodes
      remove_nodes
      remove_edges
      """
      g = g.clone()
      g.add_edges(u, v, data=data, etype=etype)
      return g
  
imports: import copy
  from collections.abc import Iterable, Mapping
  import numpy
  import scipy.sparse
  import scipy.sparse.linalg
  from ..utils import version
  from ..None import backend, batch, convert, function, ndarray, subgraph, utils
  from .._ffi.function import _init_api
  from ..base import dgl_warning, DGLError, EID, NID
  from ..frame import Frame
  from ..heterograph import DGLGraph
  from ..heterograph_index import create_heterograph_from_relations, create_metagraph_index
  from ..partition import metis_partition, metis_partition_assignment, partition_graph_with_halo
  from ..sampling.neighbor import sample_neighbors
label_desc: Use image node_id 18 for calling a global function with example usage: add_edges(g, u, v, data, etype) and returns: g