class_docstr: Class of edge data which is used for DGLGraph construction. Internal use only.
class_docstr_tok: ["Class","of","edge","data","which","is","used","for","DGLGraph","construction",".","Internal","use","only","."]
code: def to_dict(edge_data: List["EdgeData"], node_dict: dict) -> dict:
      edge_dict = {}
      for e_data in edge_data:
          (src_type, e_type, dst_type) = e_data.type
          graph_ids = np.unique(e_data.graph_id)
          for graph_id in graph_ids:
              if (
                  graph_id in edge_dict
                  and e_data.type in edge_dict[graph_id]
              ):
                  raise DGLError(
                      f"Duplicate edge type[{e_data.type}] for same graph[{graph_id}], please place the same edge_type for same graph into single EdgeData."
                  )
              idx = e_data.graph_id == graph_id
              src_mapping = node_dict[graph_id][src_type]["mapping"]
              dst_mapping = node_dict[graph_id][dst_type]["mapping"]
              orig_src_ids = e_data.src[idx].astype(
                  node_dict[graph_id][src_type]["dtype"]
              )
              orig_dst_ids = e_data.dst[idx].astype(
                  node_dict[graph_id][dst_type]["dtype"]
              )
              src_ids = [src_mapping[index] for index in orig_src_ids]
              dst_ids = [dst_mapping[index] for index in orig_dst_ids]
              if graph_id not in edge_dict:
                  edge_dict[graph_id] = {}
              edge_dict[graph_id][e_data.type] = {
                  "edges": (_tensor(src_ids), _tensor(dst_ids)),
                  "data": {
                      k: _tensor(v[idx]) for k, v in e_data.data.items()
                  },
              }
      return edge_dict
  
imports: import ast
  import os
  from typing import Callable, List, Optional
  import numpy
  import pandas
  import pydantic
  import yaml
  from ..None import backend
  from ..base import dgl_warning, DGLError
  from ..convert import heterograph
label_desc: Use image node_id 3 for calling the EdgeData obj's underlying member method code with example usage: obj.to_dict(edge_data, node_dict) and returns: edge_dict