code: def get_traversed_path_list(df, id):
      """
      Take the DataFrame result from a BFS or SSSP function call and extract
      the path to a specified vertex as a series of steps
  
      Input Parameters
      ----------
      df : cudf.DataFrame
          The dataframe containing the results of a BFS or SSSP call
  
      id : Int
          The vertex ID
  
      Returns
      ---------
      a : Python array
          a ordered array containing the steps from id to root
  
      Examples
      --------
      >>> gdf = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
      ...                     dtype=['int32', 'int32', 'float32'], header=None)
      >>> G = cugraph.Graph()
      >>> G.from_cudf_edgelist(gdf, source='0', destination='1', edge_attr='2')
      >>> sssp_df = cugraph.sssp(G, 1)
      >>> path = cugraph.utils.get_traversed_path_list(sssp_df, 32)
  
      """
  
      if "vertex" not in df.columns:
          raise ValueError(
              "DataFrame does not appear to be a BFS or "
              "SSP result - 'vertex' column missing"
          )
      if "distance" not in df.columns:
          raise ValueError(
              "DataFrame does not appear to be a BFS or "
              "SSP result - 'distance' column missing"
          )
      if "predecessor" not in df.columns:
          raise ValueError(
              "DataFrame does not appear to be a BFS or "
              "SSP result - 'predecessor' column missing"
          )
      if isinstance(id, type(df["vertex"].iloc[0])):
          raise ValueError(
              "The vertex 'id' needs to be the same as df['vertex']"
          )
  
      # There is no guarantee that the dataframe has not been filtered
      # or edited.  Therefore we cannot assume that using the vertex ID
      # as an index will work
  
      pred = -1
      answer = []
      answer.append(id)
  
      ddf = df[df["vertex"] == id]
      if len(ddf) == 0:
          raise ValueError(
              "The vertex (", id, " is not in the result set"
          )
  
      pred = ddf["predecessor"].iloc[0]
  
      while pred != -1:
          answer.append(pred)
  
          ddf = df[df["vertex"] == pred]
          pred = ddf["predecessor"].iloc[0]
  
      return answer
  
imports: import importlib
  import os
  import shutil
  from numba import cuda
  import cudf
  from cudf.core.column import as_column
  from cuda.cudart import cudaDeviceAttr
  from rmm._cuda.gpu import getDeviceAttribute
label_desc: Use image node_id 2 for calling a global function with example usage: get_traversed_path_list(df, id) and returns: answer