class_docstr: An internal class to manage filters/algorithms for polydata datasets.
class_docstr_tok: ["An","internal","class","to","manage","filters\/algorithms","for","polydata","datasets","."]
docstr: Calculate the geodesic path between two vertices using Dijkstra's algorithm.
  
  This will add an array titled ``'vtkOriginalPointIds'`` of the input
  mesh's point ids to the output mesh. The default behavior of the
  underlying ``vtkDijkstraGraphGeodesicPath`` filter is that the
  geodesic path is reversed in the resulting mesh. This is overridden
  in PyVista by default.
  
  Parameters
  ----------
  start_vertex : int
      Vertex index indicating the start point of the geodesic segment.
  
  end_vertex : int
      Vertex index indicating the end point of the geodesic segment.
  
  inplace : bool, default: False
      Whether the input mesh should be replaced with the path. The
      geodesic path is always returned.
  
  keep_order : bool, default: True
      If ``True``, the points of the returned path are guaranteed
      to start with the start vertex (as opposed to the end vertex).
  
      .. versionadded:: 0.32.0
  
  use_scalar_weights : bool, default: False
      If ``True``, use scalar values in the edge weight.
      This only works for point data.
  
  progress_bar : bool, default: False
      Display a progress bar to indicate progress.
  
  Returns
  -------
  pyvista.PolyData
      ``PolyData`` object consisting of the line segment between the
      two given vertices. If ``inplace`` is ``True`` this is the
      same object as the input mesh.
  
  Examples
  --------
  Plot the path between two points on the random hills mesh.
  
  >>> import pyvista as pv
  >>> from pyvista import examples
  >>> hills = examples.load_random_hills()
  >>> path = hills.geodesic(560, 5820)
  >>> pl = pv.Plotter()
  >>> _ = pl.add_mesh(hills)
  >>> _ = pl.add_mesh(path, line_width=5, color='k')
  >>> pl.show()
  
  See :ref:`geodesic_example` for more examples using this filter.
docstr_tok: ["Calculate","the","geodesic","path","between","two","vertices","using","Dijkstra","'s","algorithm",".","This","will","add","an","array","titled","``","'vtkOriginalPointIds","'","``","of","the","input","mesh","'s","point","ids","to","the","output","mesh",".","The","default","behavior","of","the","underlying","``","vtkDijkstraGraphGeodesicPath","``","filter","is","that","the","geodesic","path","is","reversed","in","the","resulting","mesh",".","This","is","overridden","in","PyVista","by","default",".","Parameters","--","--","--","--","--","start_vertex",":","int","Vertex","index","indicating","the","start","point","of","the","geodesic","segment",".","end_vertex",":","int","Vertex","index","indicating","the","end","point","of","the","geodesic","segment",".","inplace",":","bool",",","default",":","False","Whether","the","input","mesh","should","be","replaced","with","the","path",".","The","geodesic","path","is","always","returned",".","keep_order",":","bool",",","default",":","True","If","``","True","``",",","the","points","of","the","returned","path","are","guaranteed","to","start","with","the","start","vertex","(","as","opposed","to","the","end","vertex",")",".","..","versionadded",":",":","0.32.0","use_scalar_weights",":","bool",",","default",":","False","If","``","True","``",",","use","scalar","values","in","the","edge","weight",".","This","only","works","for","point","data",".","progress_bar",":","bool",",","default",":","False","Display","a","progress","bar","to","indicate","progress",".","Returns","--","--","--","-","pyvista.PolyData","``","PolyData","``","object","consisting","of","the","line","segment","between","the","two","given","vertices",".","If","``","inplace","``","is","``","True","``","this","is","the","same","object","as","the","input","mesh",".","Examples","--","--","--","--","Plot","the","path","between","two","points","on","the","random","hills","mesh",".",">",">",">","import","pyvista","as","pv",">",">",">","from","pyvista","import","examples",">",">",">","hills","=","examples.load_random_hills","(",")",">",">",">","path","=","hills.geodesic","(","560",",","5820",")",">",">",">","pl","=","pv.Plotter","(",")",">",">",">","_","=","pl.add_mesh","(","hills",")",">",">",">","_","=","pl.add_mesh","(","path",",","line_width=5",",","color=","'","k","'",")",">",">",">","pl.show","(",")","See",":","ref",":","`","geodesic_example","`","for","more","examples","using","this","filter","."]
code: def geodesic(
      self,
      start_vertex,
      end_vertex,
      inplace=False,
      keep_order=True,
      use_scalar_weights=False,
      progress_bar=False,
  ):
      """Calculate the geodesic path between two vertices using Dijkstra's algorithm.
  
      This will add an array titled ``'vtkOriginalPointIds'`` of the input
      mesh's point ids to the output mesh. The default behavior of the
      underlying ``vtkDijkstraGraphGeodesicPath`` filter is that the
      geodesic path is reversed in the resulting mesh. This is overridden
      in PyVista by default.
  
      Parameters
      ----------
      start_vertex : int
          Vertex index indicating the start point of the geodesic segment.
  
      end_vertex : int
          Vertex index indicating the end point of the geodesic segment.
  
      inplace : bool, default: False
          Whether the input mesh should be replaced with the path. The
          geodesic path is always returned.
  
      keep_order : bool, default: True
          If ``True``, the points of the returned path are guaranteed
          to start with the start vertex (as opposed to the end vertex).
  
          .. versionadded:: 0.32.0
  
      use_scalar_weights : bool, default: False
          If ``True``, use scalar values in the edge weight.
          This only works for point data.
  
      progress_bar : bool, default: False
          Display a progress bar to indicate progress.
  
      Returns
      -------
      pyvista.PolyData
          ``PolyData`` object consisting of the line segment between the
          two given vertices. If ``inplace`` is ``True`` this is the
          same object as the input mesh.
  
      Examples
      --------
      Plot the path between two points on the random hills mesh.
  
      >>> import pyvista as pv
      >>> from pyvista import examples
      >>> hills = examples.load_random_hills()
      >>> path = hills.geodesic(560, 5820)
      >>> pl = pv.Plotter()
      >>> _ = pl.add_mesh(hills)
      >>> _ = pl.add_mesh(path, line_width=5, color='k')
      >>> pl.show()
  
      See :ref:`geodesic_example` for more examples using this filter.
  
      """
      if not (
          0 <= start_vertex < self.n_points
          and 0 <= end_vertex < self.n_points
      ):
          raise IndexError("Invalid point indices.")
      if not self.is_all_triangles:
          raise NotAllTrianglesError(
              "Input mesh for geodesic path must be all triangles."
          )
  
      dijkstra = _vtk.vtkDijkstraGraphGeodesicPath()
      dijkstra.SetInputData(self)
      dijkstra.SetStartVertex(start_vertex)
      dijkstra.SetEndVertex(end_vertex)
      dijkstra.SetUseScalarWeights(use_scalar_weights)
      _update_alg(
          dijkstra, progress_bar, "Calculating the Geodesic Path"
      )
      original_ids = vtk_id_list_to_array(dijkstra.GetIdList())
  
      output = _get_output(dijkstra)
      if output.n_points == 0:
          raise ValueError(
              f"There is no path between vertices {start_vertex} and {end_vertex}. ",
              "It is likely the vertices belong to disconnected regions.",
          )
  
      output["vtkOriginalPointIds"] = original_ids
  
      # ensure proper order if requested
      if keep_order and original_ids[0] == end_vertex:
          output.points[...] = output.points[::-1, :]
          output["vtkOriginalPointIds"] = output["vtkOriginalPointIds"][
              ::-1
          ]
  
      if inplace:
          self.copy_from(output, deep=False)
          return self
  
      return output
  
imports: import collections.abc
  import warnings
  import numpy
  import pyvista
  from pyvista.core import _vtk_core
  from pyvista.core.errors import MissingDataError, NotAllTrianglesError, PyVistaFutureWarning, VTKVersionError
  from pyvista.core.filters import _get_output, _update_alg
  from pyvista.core.filters.data_set import DataSetFilters
  from pyvista.core.utilities.arrays import FieldAssociation, get_array, get_array_association, set_default_active_scalars, vtk_id_list_to_array
  from pyvista.core.utilities.geometric_objects import NORMALS
  from pyvista.core.utilities.helpers import generate_plane, wrap
  from pyvista.core.utilities.misc import abstract_class, assert_empty_kwargs
label_desc: Use image node_id 25 for calling the PolyDataFilters obj's underlying member method code with example usage: obj.geodesic(start_vertex, end_vertex, inplace, keep_order, use_scalar_weights, progress_bar) and returns: output, self