prg_djk_path_get()
Abstract
Returns a vector of shortest paths from the source to the destination vertex.
Syntax
prg_djk_path_get (src_vertex_ptr, dest_vertex_ptr)
| Argument | Type | Description |
|---|---|---|
src_vertex_ptr |
PrgT_Graph_Vertex * |
A source vertex of the path. |
dest_vertex_ptr |
PrgT_Graph_Vertex * |
A destination vertex of the path. |
Return Type
PrgT_Vector *
Returns the vector of shortest path routes, where each route is also a PrgT_Vector* of edges. The route vectors contain the sequence of PrgT_Graph_Edge objects in the route from the source to the destination.
Header
prg_djk.h
Details
Returns the set of shortest paths from the source to the destination vertex. If prg_djk_all_sources_compute() has been run, the function will use the routing tables to compute the path and no recomputation will be done.
If prg_djk_all_sources_compute() has not been run,
- the function will compute the shortest paths without the routing tables
- each call to
prg_djk_path_get()will recompute the paths from scratch
It is the caller's responsibility to deallocate the return value when it is not needed, by using a call to prg_vector_destroy():
prg_vector_destroy (routes_vptr, 1).
All paths within the vector will be deallocated when the main vector is deallocated.
The path consists of PrgT_Graph_Edge* elements. The vector of PrgT_Graph_Edge* elements makes up a single path.
This function also can be used to retrieve the routes from a single source to all destinations, using the workflow described for prg_djk_single_source_compute().