简体   繁体   English

最短路径如何在pgrouting中工作?

[英]How does shortest path work in pgrouting?

I'm trying to find how the implementation of shortest_path() in pgRouting works. 我试图找到pgRouting中shortest_path()的实现是如何工作的。

This is the function definition: 这是函数定义:

CREATE OR REPLACE FUNCTION shortest_path(sql text, source_id integer,target_id integer, directed boolean, has_reverse_cost boolean)  
RETURNS SETOF path_result AS '$libdir/librouting', 'shortest_path'  
  LANGUAGE c IMMUTABLE STRICT  
  COST 1  
  ROWS 1000;  
ALTER FUNCTION shortest_path(text, integer, integer, boolean, boolean) OWNER TO postgres;

My questions are: 我的问题是:

  1. How does it calls the .c file and how it passes the parameters to it (I believe it's dijkstra.c file, correct?) 它如何调用.c文件以及如何将参数传递给它(我相信它是dijkstra.c文件,对吗?)
  2. How can I take that .c file and compile it with the debug info it has in order to see how it works so I can understand it better? 我如何获取该.c文件并使用它具有的调试信息进行编译,以便了解它是如何工作的,这样我可以更好地理解它?

Here is the source for dijkstra.c. 这是dijkstra.c 的源代码 You can read this code to see what the function is doing. 您可以阅读此代码以查看该功能正在执行的操作。 The SQL you posted just shows the binding to the native C function. 您发布的SQL只显示与本机C函数的绑定。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM