prg_djk_graph_cache_enable()
Abstract
Enables graph caching for faster DJK performance.
Syntax
prg_djk_graph_cache_enable (graph_ptr)
| Argument | Type | Description |
|---|---|---|
graph_ptr |
PrgT_Graph * |
The graph that has the DJK package initialized on it, and that will be used for all future shortest-path finding. |
Return Type
void
No return value.
Header
prg_djk.h
Details
The DJK package calculates shortest paths by first converting its associated graph into internal data structures for efficient calculation. This conversion of the graph is done for each call to find shortest paths since the DJK package does not know whether or not the graph changed since the last graph was evaluated, which can be wasteful if the graph does not change from call to call.
Calling this function enables caching the internal data structure representation of the graph, which can speed up the finding of shortest paths if the same graph is used in multiple invocations of prg_djk_path_get(). The caller should call this function once, before any prg_djk_path_get() calls are made. Then, as long as the graph topology does not change, the caller can invoke prg_djk_path_get() as many times as needed, and then call prg_djk_graph_cache_disable() when done.