class_docstr: Model object containing the distance for each vertex in the graph to a
  single source vertex, which is specified during
  :func:`turicreate.shortest_path.create`.
  
  The model also allows querying for one of the shortest paths from the source
  vertex to any other vertex in the graph.
  
  Below is a list of queryable fields for this model:
  
  +----------------+------------------------------------------------------------+
  | Field          | Description                                                |
  +================+============================================================+
  | graph          | A new SGraph with the distance as a vertex property        |
  +----------------+------------------------------------------------------------+
  | distance       | An SFrame with each vertex's distance to the source vertex |
  +----------------+------------------------------------------------------------+
  | weight_field   | The edge field for weight                                  |
  +----------------+------------------------------------------------------------+
  | source_vid     | The source vertex id                                       |
  +----------------+------------------------------------------------------------+
  | max_distance   | Maximum distance between any two vertices                  |
  +----------------+------------------------------------------------------------+
  | training_time  | Total training time of the model                           |
  +----------------+------------------------------------------------------------+
  
  This model cannot be constructed directly.  Instead, use
  :func:`turicreate.shortest_path.create` to create an instance
  of this model. A detailed list of parameter options and code samples
  are available in the documentation for the create function.
  
  See Also
  --------
  create
class_docstr_tok: ["Model","object","containing","the","distance","for","each","vertex","in","the","graph","to","a","single","source","vertex",",","which","is","specified","during",":","func",":","`","turicreate.shortest_path.create","`",".","The","model","also","allows","querying","for","one","of","the","shortest","paths","from","the","source","vertex","to","any","other","vertex","in","the","graph",".","Below","is","a","list","of","queryable","fields","for","this","model",":","+","--","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","|","Field","|","Description","|","+================+============================================================+","|","graph","|","A","new","SGraph","with","the","distance","as","a","vertex","property","|","+","--","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","|","distance","|","An","SFrame","with","each","vertex","'s","distance","to","the","source","vertex","|","+","--","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","|","weight_field","|","The","edge","field","for","weight","|","+","--","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","|","source_vid","|","The","source","vertex","id","|","+","--","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","|","max_distance","|","Maximum","distance","between","any","two","vertices","|","+","--","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","|","training_time","|","Total","training","time","of","the","model","|","+","--","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","This","model","can","not","be","constructed","directly",".","Instead",",","use",":","func",":","`","turicreate.shortest_path.create","`","to","create","an","instance","of","this","model",".","A","detailed","list","of","parameter","options","and","code","samples","are","available","in","the","documentation","for","the","create","function",".","See","Also","--","--","--","--","create"]
docstr: Generates an sframe with columns: vid, parent_row_id, and distance.
  Used for speed up the path query.
docstr_tok: ["Generates","an","sframe","with","columns",":","vid",",","parent_row_id",",","and","distance",".","Used","for","speed","up","the","path","query","."]
code: def _generate_path_sframe(self):
      """
      Generates an sframe with columns: vid, parent_row_id, and distance.
      Used for speed up the path query.
      """
      source_vid = self.source_vid
      weight_field = self.weight_field
  
      query_table = _copy.copy(self.distance)
      query_table = query_table.add_row_number("row_id")
  
      g = self.graph.add_vertices(query_table)
      # The sequence id which a vertex is visited, initialized with 0 meaning not visited.
      g.vertices["__parent__"] = -1
      weight_field = self.weight_field
      if weight_field == "":
          weight_field = "__unit_weight__"
          g.edges[weight_field] = 1
  
      # Traverse the graph once and get the parent row id for each vertex
      # def traverse_fun(src, edge, dst):
      #     if src['__id'] == source_vid:
      #         src['__parent__'] = src['row_id']
      #     if dst['distance'] == src['distance'] + edge[weight_field]:
      #         dst['__parent__'] = max(dst['__parent__'], src['row_id'])
      #     return (src, edge, dst)
      #
      # the internal lambda appear to have some issues.
      traverse_fun = lambda src, edge, dst: _tc.extensions._toolkits.graph.sssp.shortest_path_traverse_function(
          src, edge, dst, source_vid, weight_field
      )
  
      g = g.triple_apply(traverse_fun, ["__parent__"])
      query_table = query_table.join(
          g.get_vertices()[["__id", "__parent__"]], "__id"
      ).sort("row_id")
      query_table.rename(
          {"__parent__": "parent_row_id", "__id": "vid"}, inplace=True
      )
      return query_table
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import turicreate
  from turicreate.data_structures.sgraph import SGraph
  from turicreate.toolkits.graph_analytics._model_base import GraphAnalyticsModel
  import copy
label_desc: Use image node_id 6 for calling the ShortestPathModel obj's underlying member method code with example usage: obj._generate_path_sframe() and returns: query_table