驾驶距离¶
pgr_drivingDistance
- 返回起始节点的行驶距离。
可用性
版本3.6.0
将输出列标准化为
(seq, depth, start_vid, pred, node, edge, cost, agg_cost)
pgr_drivingdistance
(单个顶点)添加了
depth
和start_vid
结果列。
pgr_drivingdistance
(多个顶点)结果列名称更改:
from_v``改为 ``start_vid
。添加了
depth
和``pred`` 结果列。
版本2.1.0
签名更改 pgr_drivingDistance(单顶点)
新 官方 pgr_drivingDistance(多顶点)
版本2.0.0
官方:: pgr_drivingDistance(单顶点)
描述¶
使用Dijkstra算法,提取所有成本小于或等于值 distance
的节点。提取的边将符合相应的生成树。
签名¶
directed
])(seq, depth, start_vid, pred, node, edge, cost, agg_cost)
单顶点¶
directed
])(seq, depth, start_vid, pred, node, edge, cost, agg_cost)
- 示例:
从顶点 \(11\) 到 \(3.0\) 的距离
SELECT * FROM pgr_drivingDistance(
'SELECT id, source, target, cost, reverse_cost FROM edges',
11, 3.0);
seq | depth | start_vid | pred | node | edge | cost | agg_cost
-----+-------+-----------+------+------+------+------+----------
1 | 0 | 11 | 11 | 11 | -1 | 0 | 0
2 | 1 | 11 | 11 | 7 | 8 | 1 | 1
3 | 1 | 11 | 11 | 12 | 11 | 1 | 1
4 | 1 | 11 | 11 | 16 | 9 | 1 | 1
5 | 2 | 11 | 7 | 3 | 7 | 1 | 2
6 | 2 | 11 | 7 | 6 | 4 | 1 | 2
7 | 2 | 11 | 7 | 8 | 10 | 1 | 2
8 | 2 | 11 | 16 | 15 | 16 | 1 | 2
9 | 2 | 11 | 16 | 17 | 15 | 1 | 2
10 | 3 | 11 | 3 | 1 | 6 | 1 | 3
11 | 3 | 11 | 6 | 5 | 1 | 1 | 3
12 | 3 | 11 | 8 | 9 | 14 | 1 | 3
13 | 3 | 11 | 15 | 10 | 3 | 1 | 3
(13 rows)
多顶点¶
(seq, depth, start_vid, pred, node, edge, cost, agg_cost)
- 示例:
从顶点 \({11, 16\}\) 出发,距离为 \(3.0\) 且有向图上的成本相等
SELECT * FROM pgr_drivingDistance(
'SELECT id, source, target, cost, reverse_cost FROM edges',
array[11, 16], 3.0, equicost => true);
seq | depth | start_vid | pred | node | edge | cost | agg_cost
-----+-------+-----------+------+------+------+------+----------
1 | 0 | 11 | 11 | 11 | -1 | 0 | 0
2 | 1 | 11 | 11 | 7 | 8 | 1 | 1
3 | 1 | 11 | 11 | 12 | 11 | 1 | 1
4 | 2 | 11 | 7 | 3 | 7 | 1 | 2
5 | 2 | 11 | 7 | 6 | 4 | 1 | 2
6 | 2 | 11 | 7 | 8 | 10 | 1 | 2
7 | 3 | 11 | 3 | 1 | 6 | 1 | 3
8 | 3 | 11 | 6 | 5 | 1 | 1 | 3
9 | 3 | 11 | 8 | 9 | 14 | 1 | 3
10 | 0 | 16 | 16 | 16 | -1 | 0 | 0
11 | 1 | 16 | 16 | 15 | 16 | 1 | 1
12 | 1 | 16 | 16 | 17 | 15 | 1 | 1
13 | 2 | 16 | 15 | 10 | 3 | 1 | 2
(13 rows)
参数¶
参数 |
类型 |
描述 |
---|---|---|
|
Edges SQL如下所述。 |
|
Root vid |
|
树的根顶点的标识符。 |
Root vids |
|
根顶点的标识符数组。
|
distance |
|
结果中包含节点的上限。 |
其中:
- ANY-NUMERIC:
SMALLINT
,INTEGER
,BIGINT
,REAL
,FLOAT
可选参数¶
列 |
类型 |
默认 |
描述 |
---|---|---|---|
|
|
|
|
行驶距离可选参数¶
列 |
类型 |
默认 |
描述 |
---|---|---|---|
|
|
|
|
内部查询¶
Edges SQL¶
列 |
类型 |
默认 |
描述 |
---|---|---|---|
|
ANY-INTEGER |
边的标识符。 |
|
|
ANY-INTEGER |
边的第一个端点顶点的标识符。 |
|
|
ANY-INTEGER |
边的第二个端点顶点的标识符。 |
|
|
ANY-NUMERICAL |
边( |
|
|
ANY-NUMERICAL |
-1 |
边(
|
其中:
- ANY-INTEGER:
SMALLINT
,INTEGER
,BIGINT
- ANY-NUMERICAL:
SMALLINT
,INTEGER
,BIGINT
,REAL
,FLOAT
结果列¶
Returns set of (seq, depth, start_vid, pred, node, edge, cost, agg_cost)
参数 |
类型 |
描述 |
---|---|---|
|
|
从 \(1\) 开始的顺序值。 |
|
|
|
|
|
根顶点的标识符。 |
|
|
|
|
|
使用 |
|
|
从
|
|
|
遍历 |
|
|
从 |
其他示例¶
- 示例:
在无向图上,从顶点 \({11, 16\}\) 开始的距离为 \(3.0\)
SELECT * FROM pgr_drivingDistance(
'SELECT id, source, target, cost, reverse_cost FROM edges',
array[11, 16], 3.0, directed => false);
seq | depth | start_vid | pred | node | edge | cost | agg_cost
-----+-------+-----------+------+------+------+------+----------
1 | 0 | 11 | 11 | 11 | -1 | 0 | 0
2 | 1 | 11 | 11 | 7 | 8 | 1 | 1
3 | 1 | 11 | 11 | 10 | 5 | 1 | 1
4 | 1 | 11 | 11 | 12 | 11 | 1 | 1
5 | 1 | 11 | 11 | 16 | 9 | 1 | 1
6 | 2 | 11 | 7 | 3 | 7 | 1 | 2
7 | 2 | 11 | 10 | 6 | 2 | 1 | 2
8 | 2 | 11 | 7 | 8 | 10 | 1 | 2
9 | 2 | 11 | 10 | 15 | 3 | 1 | 2
10 | 2 | 11 | 16 | 17 | 15 | 1 | 2
11 | 3 | 11 | 3 | 1 | 6 | 1 | 3
12 | 3 | 11 | 6 | 5 | 1 | 1 | 3
13 | 3 | 11 | 8 | 9 | 14 | 1 | 3
14 | 0 | 16 | 16 | 16 | -1 | 0 | 0
15 | 1 | 16 | 16 | 11 | 9 | 1 | 1
16 | 1 | 16 | 16 | 15 | 16 | 1 | 1
17 | 1 | 16 | 16 | 17 | 15 | 1 | 1
18 | 2 | 16 | 11 | 7 | 8 | 1 | 2
19 | 2 | 16 | 11 | 10 | 5 | 1 | 2
20 | 2 | 16 | 17 | 12 | 13 | 1 | 2
21 | 3 | 16 | 7 | 3 | 7 | 1 | 3
22 | 3 | 16 | 7 | 6 | 4 | 1 | 3
23 | 3 | 16 | 7 | 8 | 10 | 1 | 3
(23 rows)
另请参阅¶
pgr_alphaShape - Alpha 形状计算
示例数据 网络。
索引和表格