code: def random_walk(self, path_length, alpha=0, rand=random.Random(), start=None):
      
      G = self
      if start:
        path = [start]
      else:
        # Sampling is uniform w.r.t V, and not w.r.t E
        path = [rand.choice(list(G.keys()))]
  
      while len(path) < path_length:
        cur = path[-1]
        if len(G[cur]) > 0:
          if rand.random() >= alpha:
            path.append(rand.choice(G[cur]))
          else:
            path.append(path[0])
        else:
          break
      return [str(node) for node in path]
docs: Returns a truncated random walk.
  
          path_length: Length of the random walk.
          alpha: probability of restarts.
          start: the start node of the random walk.