code: def convert_gcn_data(dataset_name, input_dir, output_dir):
      def parse_index_file(filename):
          """Parse index file."""
          index = []
          for line in open(filename):
              index.append(int(line.strip()))
          return index
  
      names = ["x", "y", "tx", "ty", "allx", "ally", "graph"]
      objects = []
      for i in range(len(names)):
          with open(
              os.path.join(
                  input_dir, "ind.{}.{}".format(dataset_name, names[i])
              ),
              "rb",
          ) as f:
              if sys.version_info > (3, 0):
                  objects.append(pkl.load(f, encoding="latin1"))
              else:
                  objects.append(pkl.load(f))
  
      x, y, tx, ty, allx, ally, graph = tuple(objects)
      test_idx_reorder = parse_index_file(
          os.path.join(
              input_dir, "ind.{}.test.index".format(dataset_name)
          )
      )
      test_idx_range = np.sort(test_idx_reorder)
  
      if dataset_name == "citeseer":
          # Fix citeseer dataset (there are some isolated nodes in the graph)
          # Find isolated nodes, add them as zero-vecs into the right position
          test_idx_range_full = range(
              min(test_idx_reorder), max(test_idx_reorder) + 1
          )
          tx_extended = sp.lil_matrix(
              (len(test_idx_range_full), x.shape[1])
          )
          tx_extended[test_idx_range - min(test_idx_range), :] = tx
          tx = tx_extended
          ty_extended = np.zeros((len(test_idx_range_full), y.shape[1]))
          ty_extended[test_idx_range - min(test_idx_range), :] = ty
          ty = ty_extended
  
      features = sp.vstack((allx, tx)).tolil()
      features[test_idx_reorder, :] = features[test_idx_range, :]
      G = nx.from_dict_of_lists(graph)
      adj = nx.adjacency_matrix(G)
  
      labels = np.vstack((ally, ty))
      labels[test_idx_reorder, :] = labels[test_idx_range, :]
      print(G.number_of_nodes(), G.number_of_edges())
      with open("data/{}/label.txt".format(dataset_name), "w") as f:
          for i in range(len(labels)):
              assert sum(labels[i]) > 0
              for j, k in enumerate(labels[i]):
                  if k == 1:
                      print(i, j, file=f)
  
      with open(
          "data/{}/graph.edgelist".format(dataset_name), "w"
      ) as f:
          for i, j in G.edges():
              print(i, j, file=f)
  
      sp.save_npz(
          "data/{}/features.npz".format(dataset_name), features.tocsr()
      )
  
imports: import random
  import os
  import sys
  import collections
  import itertools
  import pickle
  import scipy.sparse
  import networkx
  import numpy
  from sklearn.cluster import SpectralClustering
  from sklearn import gaussian_process
  from scipy.optimize import minimize
  from bayes_opt import BayesianOptimization
label_desc: Use image node_id 15 for calling a global function with example usage: convert_gcn_data(dataset_name, input_dir, output_dir) and returns: index