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: Get the shortest path.
  Return one of the shortest paths between the source vertex defined
  in the model and the query vertex.
  The source vertex is specified by the original call to shortest path.
  Optionally, plots the path with networkx.
  
  Parameters
  ----------
  vid : string
      ID of the destination vertex. The source vertex ID is specified
      when the shortest path result is first computed.
  
  highlight : list
      If the path is plotted, identifies the vertices (by vertex ID) that
      should be highlighted by plotting in a different color.
  
  Returns
  -------
  path : list
      List of pairs of (vertex_id, distance) in the path.
  
  Examples
  --------
  >>> m.get_path(vid=0)
docstr_tok: ["Get","the","shortest","path",".","Return","one","of","the","shortest","paths","between","the","source","vertex","defined","in","the","model","and","the","query","vertex",".","The","source","vertex","is","specified","by","the","original","call","to","shortest","path",".","Optionally",",","plots","the","path","with","networkx",".","Parameters","--","--","--","--","--","vid",":","string","ID","of","the","destination","vertex",".","The","source","vertex","ID","is","specified","when","the","shortest","path","result","is","first","computed",".","highlight",":","list","If","the","path","is","plotted",",","identifies","the","vertices","(","by","vertex","ID",")","that","should","be","highlighted","by","plotting","in","a","different","color",".","Returns","--","--","--","-","path",":","list","List","of","pairs","of","(","vertex_id",",","distance",")","in","the","path",".","Examples","--","--","--","--",">",">",">","m.get_path","(","vid=0",")"]
code: def get_path(self, vid, highlight=None):
      """
      Get the shortest path.
      Return one of the shortest paths between the source vertex defined
      in the model and the query vertex.
      The source vertex is specified by the original call to shortest path.
      Optionally, plots the path with networkx.
  
      Parameters
      ----------
      vid : string
          ID of the destination vertex. The source vertex ID is specified
          when the shortest path result is first computed.
  
      highlight : list
          If the path is plotted, identifies the vertices (by vertex ID) that
          should be highlighted by plotting in a different color.
  
      Returns
      -------
      path : list
          List of pairs of (vertex_id, distance) in the path.
  
      Examples
      --------
      >>> m.get_path(vid=0)
      """
      if self._path_query_table is None:
          self._path_query_table = self._generate_path_sframe()
  
      source_vid = self.source_vid
      path = []
      path_query_table = self._path_query_table
      if not vid in path_query_table["vid"]:
          raise ValueError(
              "Destination vertex id " + str(vid) + " not found"
          )
  
      record = path_query_table[path_query_table["vid"] == vid][0]
      dist = record["distance"]
      if dist > 1e5:
          raise ValueError(
              "The distance to {} is too large to show the path.".format(
                  vid
              )
          )
  
      path = [(vid, dist)]
      max_iter = len(path_query_table)
      num_iter = 0
      while record["distance"] != 0 and num_iter < max_iter:
          parent_id = record["parent_row_id"]
          assert parent_id < len(path_query_table)
          assert parent_id >= 0
          record = path_query_table[parent_id]
          path.append((record["vid"], record["distance"]))
          num_iter += 1
      assert record["vid"] == source_vid
      assert num_iter < max_iter
      path.reverse()
      return path
  
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 5 for calling the ShortestPathModel obj's underlying member method code with example usage: obj.get_path(vid, highlight) and returns: path