code: def load_graph(edgelist_filename, label_name=None):
      G = nx.read_edgelist(edgelist_filename, nodetype=int)
      if label_name is not None:
          labels = np.loadtxt(label_name, dtype=int)
          # multi-label
          l = collections.defaultdict(list)
          for i, j in labels:
              l[i].append(j)
          # Warning:: The call order of arguments `values` and `name` switched between v1.x & v2.x.
          nx.set_node_attributes(G, l, "label")
      print("load graph", G.number_of_nodes(), G.number_of_edges())
      return G
  
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 7 for calling a global function with example usage: load_graph(edgelist_filename, label_name) and returns: G