code: def construct_graph(data_set, total_users, total_items):
      """
      Generates graph given a cornac data set
  
      Parameters
      ----------
      data_set : cornac.data.dataset.Dataset
          The data set as provided by cornac
      """
      user_indices, item_indices, _ = data_set.uir_tuple
  
      data_dict = {
          (USER_KEY, "user_item", ITEM_KEY): (
              user_indices,
              item_indices,
          ),
          (ITEM_KEY, "item_user", USER_KEY): (
              item_indices,
              user_indices,
          ),
      }
      num_dict = {USER_KEY: total_users, ITEM_KEY: total_items}
  
      return dgl.heterograph(data_dict, num_nodes_dict=num_dict)
  
file_path: cornac/cornac/models/lightgcn/lightgcn.py
imports: import torch
  import torch.nn
  import torch.nn.functional
  import dgl
  import dgl.function
label_desc: Use image node_id 1 for calling a global function with example usage: construct_graph(data_set, total_users, total_items) and returns: dgl