class_docstr: The class wrapper the PGL graph, the class involve the funtions to implement struc2vec algorithm.
docstr: Normlation the distance between nodes, weight[1, 2, ....N] = distance[1, 2, ......N] / sum(distance)
docstr_tok: ["Normlation","the","distance","between","nodes",",","weight","[","1",",","2",",","....","N","]","=","distance","[","1",",","2",",","......","N","]","\/","sum","(","distance",")"]
code: def normlization_layer_weight(self):
      """
      Normlation the distance between nodes, weight[1, 2, ....N] = distance[1, 2, ......N] / sum(distance)
      """
      for sd_keys, layer_weight in self.distance.items():
          src, dist = sd_keys
          layers, weights = layer_weight.keys(), layer_weight.values()
          for layer, weight in zip(layers, weights):
              if layer not in self.layer_distance:
                  self.layer_distance[layer] = {}
              if layer not in self.layer_message:
                  self.layer_message[layer] = {}
              self.layer_distance[layer][src, dist] = weight
  
              if src not in self.layer_message[layer]:
                  self.layer_message[layer][src] = []
              if dist not in self.layer_message[layer]:
                  self.layer_message[layer][dist] = []
              self.layer_message[layer][src].append(dist)
              self.layer_message[layer][dist].append(src)
  
      # normalization the layer weight
      for i in range(0, self.depth):
          layer_weight = 0.0
          layer_count = 0
          if i not in self.layer_norm_distance:
              self.layer_norm_distance[i] = {}
          if i not in self.sample_alias:
              self.sample_alias[i] = {}
          if i not in self.sample_events:
              self.sample_events[i] = {}
          if i not in self.layer_message:
              continue
          for node in self.nodes:
              if node not in self.layer_message[i]:
                  continue
              nbhs = self.layer_message[i][node]
              weights = []
              sum_weight = 0.0
              for dist in nbhs:
                  if (node, dist) in self.layer_distance[i]:
                      weight = self.layer_distance[i][node, dist]
                  else:
                      weight = self.layer_distance[i][dist, node]
                  weight = np.exp(-float(weight))
                  weights.append(weight)
              # norm the weight
              sum_weight = sum(weights)
              if sum_weight == 0.0:
                  sum_weight = 1.0
              weight_list = [weight / sum_weight for weight in weights]
              self.layer_norm_distance[i][node] = weight_list
              alias, events = alias_sample_build_table(
                  np.array(weight_list)
              )
              self.sample_alias[i][node] = alias
              self.sample_events[i][node] = events
              layer_weight += 1.0
              # layer_weight += sum(weight_list)
              layer_count += len(weights)
          layer_avg_weight = layer_weight / (1.0 * layer_count)
  
          self.layer_node_weight_count[i] = dict()
          for node in self.nodes:
              if node not in self.layer_norm_distance[i]:
                  continue
              weight_list = self.layer_norm_distance[i][node]
              node_cnt = 0
              for weight in weight_list:
                  if weight > layer_avg_weight:
                      node_cnt += 1
              self.layer_node_weight_count[i][node] = node_cnt
  
imports: import argparse
  import math
  import random
  import numpy
  import pgl
  from pgl import graph
  from pgl.graph_kernel import alias_sample_build_table
  from pgl.sample import alias_sample
  from data_loader import EdgeDataset
  from classify import train_lr_model
  from sklearn_classify import train_lr_l2_model
label_desc: Use image node_id 10 for calling the StrucVecGraph obj's underlying member method code with example usage: obj.normlization_layer_weight() without return types