code: def run_random_walks(G, nodes, num_walks=N_WALKS):
      pairs = []
      for count, node in enumerate(nodes):
          if G.degree(node) == 0:
              continue
          for i in range(num_walks):
              curr_node = node
              for j in range(WALK_LEN):
                  next_node = random.choice(G.neighbors(curr_node))
                  # self co-occurrences are useless
                  if curr_node != node:
                      pairs.append((node, curr_node))
                  curr_node = next_node
          if count % 1000 == 0:
              print("Done walks for", count, "nodes")
      return pairs
  
file_path: GraphSAGE/graphsage/utils.py
imports: from __future__ import print_function
  import numpy
  import random
  import json
  import sys
  import os
  import networkx
  from networkx.readwrite import json_graph
label_desc: Use image node_id 2 for calling a global function with example usage: run_random_walks(G, nodes, num_walks) and returns: pairs