code: def filter_unreachable(df):
      """
      Remove unreachable vertices from the result of SSSP or BFS
  
      Parameters
      ----------
      df : cudf.DataFrame
          cudf.DataFrame that is the output of SSSP or BFS
  
      Returns
      -------
      df : filtered cudf.DataFrame with only reachable vertices
          df['vertex'][i] gives the vertex id of the i'th vertex.
          df['distance'][i] gives the path distance for the i'th vertex from the
          starting vertex.
          df['predecessor'][i] gives the vertex that was reached before the i'th
          vertex in the traversal.
      """
      if "distance" not in df:
          raise KeyError("No distance column found in input data frame")
      if np.issubdtype(df["distance"].dtype, np.integer):
          max_val = np.iinfo(df["distance"].dtype).max
          return df[df.distance != max_val]
      elif np.issubdtype(df["distance"].dtype, np.inexact):
          max_val = np.finfo(df["distance"].dtype).max
          return df[df.distance != max_val]
      else:
          raise TypeError("distance type unsupported")
  
file_path: cugraph/python/cugraph/cugraph/traversal/sssp.py
imports: import numpy
  import cudf
  from cugraph.structure import Graph, MultiGraph
  from cugraph.utilities import ensure_cugraph_obj, is_matrix_type, is_cp_matrix_type, is_nx_graph_type, cupy_package
  from pylibcugraph import sssp, ResourceHandle
label_desc: Use image node_id 4 for calling a global function with example usage: filter_unreachable(df) and returns: df, df