code: def get_vertices(v, degree_v, degrees, n_nodes):
      a_vertices_selected = 2 * math.log(n_nodes, 2)
      vertices = []
      try:
          c_v = 0
  
          for v2 in degrees[degree_v]["vertices"]:
              if v != v2:
                  vertices.append(v2)  # same degree
                  c_v += 1
                  if c_v > a_vertices_selected:
                      raise StopIteration
  
          if "before" not in degrees[degree_v]:
              degree_b = -1
          else:
              degree_b = degrees[degree_v]["before"]
          if "after" not in degrees[degree_v]:
              degree_a = -1
          else:
              degree_a = degrees[degree_v]["after"]
          if degree_b == -1 and degree_a == -1:
              raise StopIteration  # not anymore v
          degree_now = verifyDegrees(
              degrees, degree_v, degree_a, degree_b
          )
          # nearest valid degree
          while True:
              for v2 in degrees[degree_now]["vertices"]:
                  if v != v2:
                      vertices.append(v2)
                      c_v += 1
                      if c_v > a_vertices_selected:
                          raise StopIteration
  
              if degree_now == degree_b:
                  if "before" not in degrees[degree_b]:
                      degree_b = -1
                  else:
                      degree_b = degrees[degree_b]["before"]
              else:
                  if "after" not in degrees[degree_a]:
                      degree_a = -1
                  else:
                      degree_a = degrees[degree_a]["after"]
  
              if degree_b == -1 and degree_a == -1:
                  raise StopIteration
  
              degree_now = verifyDegrees(
                  degrees, degree_v, degree_a, degree_b
              )
  
      except StopIteration:
          return list(vertices)
  
      return list(vertices)
  
imports: import math
  import os
  import shutil
  from collections import ChainMap, deque
  import numpy
  import pandas
  from fastdtw import fastdtw
  from gensim.models import Word2Vec
  from joblib import Parallel, delayed
  from ..alias import create_alias_table
  from ..utils import partition_dict, preprocess_nxgraph
  from ..walker import BiasedWalker
label_desc: Use image node_id 5 for calling a global function with example usage: get_vertices(v, degree_v, degrees, n_nodes) and returns: list, list