code: def undirected_graph(data):
      """
      A pre_transform function that transfers the directed graph into undirected graph.
      Args:
          data (torch_geometric.data.Data): Directed graph in the format :class:`torch_geometric.data.Data`.
          where the :obj:`data.x`, :obj:`data.edge_index` are required.
      """
      data.edge_index = torch.cat(
          [
              torch.stack(
                  [data.edge_index[1], data.edge_index[0]], dim=0
              ),
              data.edge_index,
          ],
          dim=1,
      )
      return data
  
imports: import os
  import glob
  import json
  import torch
  import pickle
  import numpy
  import os.path
  from torch_geometric.data import Data, InMemoryDataset
  import traceback
label_desc: Use image node_id 1 for calling a global function with example usage: undirected_graph(data) and returns: data