code: def sample_neigh(graph, size):
      while True:
          start_node = np.random.choice(list(graph.nodes))
          neigh = [start_node]
          frontier = list(set(graph.neighbors(start_node)) - set(neigh))
          visited = set([start_node])
          while len(neigh) < size and frontier:
              new_node = np.random.choice(list(frontier))
              assert new_node not in neigh
              neigh.append(new_node)
              visited.add(new_node)
              frontier += list(graph.neighbors(new_node))
              frontier = [x for x in frontier if x not in visited]
          if len(neigh) == size:
              return graph, neigh
  
imports: import numpy
  import networkx
  import random
  import torch
  import itertools
label_desc: Use image node_id 8 for calling a global function with example usage: sample_neigh(graph, size) and returns: graph,  neigh