<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def geodesic(self, start_vertex, end_vertex, inplace=False):
 """ Calculates the geodesic path betweeen two vertices using Dijkstra's algorithm. 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. Returns ------- output : vtki.PolyData PolyData object consisting of the line segment between the two given vertices. """

        if start_vertex < 0 or end_vertex > self.n_points - 1:
            raise IndexError('Invalid indices.')

        dijkstra = vtk.vtkDijkstraGraphGeodesicPath()
        dijkstra.SetInputData(self)
        dijkstra.SetStartVertex(start_vertex)
        dijkstra.SetEndVertex(end_vertex)
        dijkstra.Update()

        output = _get_output(dijkstra)

        if inplace:
            self.overwrite(output)
        else:
            return output