code: def sssp(
      G,
      source=None,
      method=None,
      directed=None,
      return_predecessors=None,
      unweighted=None,
      overwrite=None,
      indices=None,
      cutoff=None,
      edge_attr="weight",
  ):
      """
      Compute the distance and predecessors for shortest paths from the specified
      source to all the vertices in the graph. The distances column will store
      the distance from the source to each vertex. The predecessors column will
      store each vertex's predecessor in the shortest path. Vertices that are
      unreachable will have a distance of infinity denoted by the maximum value
      of the data type and the predecessor set as -1. The source vertex's
      predecessor is also set to -1. Graphs with negative weight cycles are not
      supported.  Unweighted graphs are also unsupported.
  
      For finding shortest paths on an unweighted graph, use BFS instead.
  
      Parameters
      ----------
      graph : cugraph.Graph, networkx.Graph, CuPy or SciPy sparse matrix Graph or
          matrix object, which should contain the connectivity information. Edge
          weights, if present, should be single or double precision floating
          point values.
          The current implementation only supports weighted graphs.
      source : int
          Index of the source vertex.
      cutoff : double, optional (default=None)
          Maximum edge weight sum considered by the algorithm
      edge_attr : str, optional (default='weight')
          The name of the edge attribute that represents the weight of an edge.
          This currently applies only when G is a NetworkX Graph.
          Default value is 'weight', which follows NetworkX convention.
  
      Returns
      -------
      Return value type is based on the input type.  If G is a cugraph.Graph,
      returns:
  
         cudf.DataFrame
            df['vertex']
                vertex id
  
            df['distance']
                gives the path distance from the starting vertex
  
            df['predecessor']
                the vertex it was reached from
  
      If G is a networkx.Graph, returns:
  
         pandas.DataFrame with contents equivalent to the cudf.DataFrame
         described above.
  
      If G is a CuPy or SciPy matrix, returns:
         a 2-tuple of CuPy ndarrays (if CuPy matrix input) or Numpy ndarrays (if
         SciPy matrix input) representing:
  
         distance: cupy or numpy ndarray
            ndarray of shortest distances between source and vertex.
  
         predecessor: cupy or numpy ndarray
            ndarray of predecessors of a vertex on the path from source, which
            can be used to reconstruct the shortest paths.
  
      Examples
      --------
      >>> from cugraph.datasets import karate
      >>> G = karate.get_graph(download=True)
      >>> distances = cugraph.sssp(G, 0)
      >>> distances
              distance  vertex  predecessor
      ...       ...     ...         ...
      ...       ...     ...         ...
      ...       ...     ...         ...
  
      """
      (source, directed, return_predecessors) = _ensure_args(
          G,
          source,
          method,
          directed,
          return_predecessors,
          unweighted,
          overwrite,
          indices,
      )
  
      (G, input_type) = ensure_cugraph_obj(
          G,
          nx_weight_attr=edge_attr,
          matrix_graph_type=Graph(directed=directed),
      )
  
      if not G.is_weighted():
          err_msg = (
              "'SSSP' requires the input graph to be weighted."
              "'BFS' should be used instead of 'SSSP' for unweighted graphs."
          )
          raise RuntimeError(err_msg)
  
      if not G.has_node(source):
          raise ValueError("Graph does not contain source vertex")
  
      if G.renumbered:
          if isinstance(source, cudf.DataFrame):
              source = G.lookup_internal_vertex_id(
                  source, source.columns
              ).iloc[0]
          else:
              source = G.lookup_internal_vertex_id(
                  cudf.Series([source])
              )[0]
  
      if cutoff is None:
          cutoff = np.inf
  
      # compute_predecessors MUST be true in the current version of sssp
      vertices, distances, predecessors = pylibcugraph_sssp(
          resource_handle=ResourceHandle(),
          graph=G._plc_graph,
          source=source,
          cutoff=cutoff,
          compute_predecessors=True,
          do_expensive_check=False,
      )
  
      df = cudf.DataFrame(
          {
              "distance": cudf.Series(distances),
              "vertex": cudf.Series(vertices),
              "predecessor": cudf.Series(predecessors),
          }
      )
  
      if G.renumbered:
          df = G.unrenumber(df, "vertex")
          df = G.unrenumber(df, "predecessor")
          df.fillna(-1, inplace=True)
  
      return _convert_df_to_output_type(
          df, input_type, return_predecessors
      )
  
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 3 for calling a global function with example usage: sssp(G, source, method, directed, return_predecessors, unweighted, overwrite, indices, cutoff, edge_attr) and returns: _convert_df_to_output_type