prg_djk_single_source_compute()

Abstract

Runs Dijkstra's shortest path algorithm and builds up a routing table at the source that includes next hops to all destinations in the graph.

Syntax

prg_djk_single_source_compute (src_vertex_ptr)
Argument Type Description
src_vertex_ptr PrgT_Graph_Vertex * The vertex at which to build the routing table. It is also used as the source vertex for the Dijkstra's shortest path algorithm.

Return Type

PrgT_Compcode

PrgC_Compcode_Success if the routing table at the source has been built; PrgC_Compcode_Failure otherwise.

prg_djk.h

Details

The function will run Dijkstra's shortest path algorithm on the graph with src_vertex_ptr as its source. After it determines the shortest paths to every destination, the function will build up a routing table at the source which, given a destination, will tell us what are the possible next hops we could take to get there.

If prg_djk_single_source_compute() is called multiple times, it will not recompute the routing table after it has been built the first time. If you want to re-run the shortest path computation, call prg_djk_graph_init() to re-initialize the routing tables at each node.

To get a routing table of the first hop from a single source to all destinations:

  1. Call prg_djk_single_source_compute().
  2. Call prg_djk_next_hops_get() for each destination.

To get the set of paths between a single source and all destinations:

  1. Call prg_djk_graph_cache_enable() to make sure the route computation results will be saved.
  2. Call prg_djk_single_source_compute().
  3. Make repeated calls to prg_djk_path_get() or prg_djk_path_get_options() to retrieve the paths one node-pair at a time.
  4. When you are finished with the path operations, or if a change to the graph has invalidated the current results, call prg_djk_graph_cache_disable() to free the cache.

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · Documentation compiled and provided by Beijing ZNetLink Technology Co., Ltd.

交流群 · QQ Group:OPNET/智网妙算网络仿真交流群(群号 486383494)

原文档 © 2017 Riverbed Technology · 本站为公益翻译,由 AI 辅助完成,请仔细甄别

Original documentation © 2017 Riverbed Technology. Community translation, AI-assisted. Contact: jiazequn@znetlink.com