Skip to content

Commit 45ede3d

Browse files
committed
Updating documentation about pgr_bdDijkstra
1 parent 96f68af commit 45ede3d

File tree

4 files changed

+251
-21
lines changed

4 files changed

+251
-21
lines changed

doc/bdDijkstra/pgr_bdDijkstra.rst

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,37 +21,38 @@ algorithm.
2121

2222
.. rubric:: Availability:
2323

24-
* Version 4.0.0
24+
.. rubric:: Version 4.0.0
2525

26-
* Combinations signature promoted to official.
26+
* Output columns standardized to |short-generic-result|
27+
* Combinations signature promoted to official.
2728

28-
* Version 3.2.0
29+
.. rubric:: Version 3.2.0
2930

30-
* New proposed signature:
31+
* New proposed signature:
3132

32-
* pgr_bdDijkstra(Combinations)
33+
* pgr_bdDijkstra(Combinations)
3334

34-
* Version 3.0.0
35+
.. rubric:: Version 3.0.0
3536

36-
* Function promoted to official.
37+
* Function promoted to official.
3738

38-
* Version 2.5.0
39+
.. rubric:: Version 2.5.0
3940

40-
* New proposed signatures:
41+
* New proposed signatures:
4142

42-
* pgr_bdDijkstra(One to Many)
43-
* pgr_bdDijkstra(Many to One)
44-
* pgr_bdDijkstra(Many to Many)
43+
* pgr_bdDijkstra(One to Many)
44+
* pgr_bdDijkstra(Many to One)
45+
* pgr_bdDijkstra(Many to Many)
4546

46-
* Version 2.4.0
47+
.. rubric:: Version 2.4.0
4748

48-
* Signature change on pgr_bdDijsktra(One to One)
49+
* Signature change on pgr_bdDijsktra(One to One)
4950

50-
* Old signature no longer supported
51+
* Old signature no longer supported
5152

52-
* Version 2.0.0
53+
.. rubric:: Version 2.0.0
5354

54-
* New official function.
55+
* New official function.
5556

5657

5758
Description
@@ -79,7 +80,7 @@ Signatures
7980
| pgr_bdDijkstra(`Edges SQL`_, **start vids**, **end vids**, [``directed``])
8081
| pgr_bdDijkstra(`Edges SQL`_, `Combinations SQL`_, [``directed``])
8182
82-
| Returns set of |old-generic-result|
83+
| Returns set of |short-generic-result|
8384
| OR EMPTY SET
8485
8586
.. index::
@@ -93,7 +94,7 @@ One to One
9394

9495
| pgr_bdDijkstra(`Edges SQL`_, **start vid**, **end vid**, [``directed``])
9596
96-
| Returns set of |result-1-1|
97+
| Returns set of |short-generic-result|
9798
| OR EMPTY SET
9899
99100
:Example: From vertex :math:`6` to vertex :math:`10` on a **directed** graph
@@ -113,7 +114,7 @@ One to Many
113114

114115
| pgr_bdDijkstra(`Edges SQL`_, **start vid**, **end vids**, [``directed``])
115116
116-
| Returns set of |result-1-m|
117+
| Returns set of |short-generic-result|
117118
| OR EMPTY SET
118119
119120
:Example: From vertex :math:`6` to vertices :math:`\{10, 17\}` on a **directed**
@@ -134,7 +135,7 @@ Many to One
134135

135136
| pgr_bdDijkstra(`Edges SQL`_, **start vids**, **end vid**, [``directed``])
136137
137-
| Returns set of |result-m-1|
138+
| Returns set of |short-generic-result|
138139
| OR EMPTY SET
139140
140141
:Example: From vertices :math:`\{6, 1\}` to vertex :math:`17` on a **directed**

doc/src/migration.rst

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,97 @@ If you have SFCGAL, which you can install using
4848
* For PostGIS 3.5+ use the old name ``ST_AlphaShape``
4949

5050
Other PostGIS options are
51+
5152
* `ST_ConvexHull <https://postgis.net/docs/ST_ConvexHull.html>`__
5253
* `ST_ConcaveHull <https://postgis.net/docs/ST_ConcaveHull.html>`__
5354

55+
Migration of ``pgr_bdDijkstra``
56+
-------------------------------------------------------------------------------
57+
58+
Starting from `v4.0.0 <https://docs.pgrouting.org/4.0/en/migration.html>`__
59+
:doc:`pgr_bdDijkstra` result columns are being standardized.
60+
61+
:from: |old-generic-result|
62+
:to: |short-generic-result|
63+
64+
Signatures to be migrated:
65+
66+
* ``pgr_bdDijkstra`` (One to One)
67+
* ``pgr_bdDijkstra`` (One to Many)
68+
* ``pgr_bdDijkstra`` (Many to One)
69+
70+
.. rubric:: Before Migration
71+
72+
Output columns were |old-generic-result|
73+
74+
.. rubric:: Migration
75+
76+
Output columns are |short-generic-result|
77+
78+
To get the old version column names, depending on the signature:
79+
80+
* Filter out the columns: ``start_vid`` and/or ``end_vid``
81+
82+
``pgr_bdDijkstra`` (`One to One`)
83+
...............................................................................
84+
85+
Using
86+
`this <https://docs.pgrouting.org/3.8/en/pgr_bdDijkstra.html#one-to-one>`__
87+
example.
88+
89+
:from: |result-1-1|
90+
:to: |short-generic-result|
91+
92+
.. literalinclude:: migration.queries
93+
:start-after: --bdDijkstra-1-to-1
94+
:end-before: --bdDijkstra-1-to-1-filter
95+
96+
Get the old signature columns by filtering out the extra columns.
97+
98+
.. literalinclude:: migration.queries
99+
:start-after: --bdDijkstra-1-to-1-filter
100+
:end-before: --bdDijkstra-1-to-m
101+
102+
``pgr_bdDijkstra`` (`One to Many`)
103+
...............................................................................
104+
105+
Using
106+
`this <https://docs.pgrouting.org/3.8/en/pgr_bdDijkstra.html#one-to-many>`__
107+
example.
108+
109+
:from: |result-1-m|
110+
:to: |short-generic-result|
111+
112+
.. literalinclude:: migration.queries
113+
:start-after: --bdDijkstra-1-to-m
114+
:end-before: --bdDijkstra-1-to-m-filter
115+
116+
Get the old signature columns by filtering out the extra columns.
117+
118+
.. literalinclude:: migration.queries
119+
:start-after: --bdDijkstra-1-to-m-filter
120+
:end-before: --bdDijkstra-m-to-1
121+
122+
``pgr_bdDijkstra`` (`Many to One`)
123+
...............................................................................
124+
125+
Using
126+
`this <https://docs.pgrouting.org/3.8/en/pgr_bdDijkstra.html#many-to-one>`__
127+
example.
128+
129+
:from: |result-m-1|
130+
:to: |generic-result|
131+
132+
.. literalinclude:: migration.queries
133+
:start-after: --bdDijkstra-m-to-1
134+
:end-before: --bdDijkstra-m-to-1-filter
135+
136+
Get the old signature columns by filtering out the extra columns.
137+
138+
.. literalinclude:: migration.queries
139+
:start-after: --bdDijkstra-m-to-1-filter
140+
:end-before: --bdDijkstra-END
141+
54142
Migration of ``pgr_nodeNetwork``
55143
-------------------------------------------------------------------------------
56144

docqueries/src/migration.pg

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,3 +490,35 @@ FROM pgr_withPointsCost(
490490
'SELECT * FROM (VALUES (-1, 10), (6, -3)) AS combinations(source, target)',
491491
driving_side => 'r');
492492
/* --withPointsCost-END */
493+
494+
-- bdDijkstra
495+
/* --bdDijkstra-1-to-1 */
496+
SELECT * FROM pgr_bdDijkstra(
497+
'select id, source, target, cost, reverse_cost from edges',
498+
6, 10, true);
499+
/* --bdDijkstra-1-to-1-filter */
500+
SELECT seq, path_seq, node, edge, cost, agg_cost
501+
FROM pgr_bdDijkstra(
502+
'select id, source, target, cost, reverse_cost from edges',
503+
6, 10, true);
504+
/* --bdDijkstra-1-to-m */
505+
SELECT * FROM pgr_bdDijkstra(
506+
'select id, source, target, cost, reverse_cost from edges',
507+
6, ARRAY[10, 17]);
508+
/* --bdDijkstra-1-to-m-filter */
509+
SELECT seq, path_seq, end_vid AS end_pid, node, edge, cost, agg_cost
510+
FROM pgr_bdDijkstra(
511+
'select id, source, target, cost, reverse_cost from edges',
512+
6, ARRAY[10, 17]);
513+
/* --bdDijkstra-m-to-1 */
514+
SELECT * FROM pgr_bdDijkstra(
515+
'select id, source, target, cost, reverse_cost from edges',
516+
ARRAY[6, 1], 17);
517+
/* --bdDijkstra-m-to-1-filter */
518+
SELECT seq, path_seq, start_vid AS start_pid, node, edge, cost, agg_cost
519+
FROM pgr_bdDijkstra(
520+
'select id, source, target, cost, reverse_cost from edges',
521+
ARRAY[6, 1], 17);
522+
/* --bdDijkstra-END */
523+
524+

docqueries/src/migration.result

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,5 +1470,114 @@ FROM pgr_withPointsCost(
14701470
(2 rows)
14711471

14721472
/* --withPointsCost-END */
1473+
-- bdDijkstra
1474+
/* --bdDijkstra-1-to-1 */
1475+
SELECT * FROM pgr_bdDijkstra(
1476+
'select id, source, target, cost, reverse_cost from edges',
1477+
6, 10, true);
1478+
seq | path_seq | start_vid | end_vid | node | edge | cost | agg_cost
1479+
-----+----------+-----------+---------+------+------+------+----------
1480+
1 | 1 | 6 | 10 | 6 | 4 | 1 | 0
1481+
2 | 2 | 6 | 10 | 7 | 8 | 1 | 1
1482+
3 | 3 | 6 | 10 | 11 | 9 | 1 | 2
1483+
4 | 4 | 6 | 10 | 16 | 16 | 1 | 3
1484+
5 | 5 | 6 | 10 | 15 | 3 | 1 | 4
1485+
6 | 6 | 6 | 10 | 10 | -1 | 0 | 5
1486+
(6 rows)
1487+
1488+
/* --bdDijkstra-1-to-1-filter */
1489+
SELECT seq, path_seq, node, edge, cost, agg_cost
1490+
FROM pgr_bdDijkstra(
1491+
'select id, source, target, cost, reverse_cost from edges',
1492+
6, 10, true);
1493+
seq | path_seq | node | edge | cost | agg_cost
1494+
-----+----------+------+------+------+----------
1495+
1 | 1 | 6 | 4 | 1 | 0
1496+
2 | 2 | 7 | 8 | 1 | 1
1497+
3 | 3 | 11 | 9 | 1 | 2
1498+
4 | 4 | 16 | 16 | 1 | 3
1499+
5 | 5 | 15 | 3 | 1 | 4
1500+
6 | 6 | 10 | -1 | 0 | 5
1501+
(6 rows)
1502+
1503+
/* --bdDijkstra-1-to-m */
1504+
SELECT * FROM pgr_bdDijkstra(
1505+
'select id, source, target, cost, reverse_cost from edges',
1506+
6, ARRAY[10, 17]);
1507+
seq | path_seq | start_vid | end_vid | node | edge | cost | agg_cost
1508+
-----+----------+-----------+---------+------+------+------+----------
1509+
1 | 1 | 6 | 10 | 6 | 4 | 1 | 0
1510+
2 | 2 | 6 | 10 | 7 | 8 | 1 | 1
1511+
3 | 3 | 6 | 10 | 11 | 9 | 1 | 2
1512+
4 | 4 | 6 | 10 | 16 | 16 | 1 | 3
1513+
5 | 5 | 6 | 10 | 15 | 3 | 1 | 4
1514+
6 | 6 | 6 | 10 | 10 | -1 | 0 | 5
1515+
7 | 1 | 6 | 17 | 6 | 4 | 1 | 0
1516+
8 | 2 | 6 | 17 | 7 | 8 | 1 | 1
1517+
9 | 3 | 6 | 17 | 11 | 11 | 1 | 2
1518+
10 | 4 | 6 | 17 | 12 | 13 | 1 | 3
1519+
11 | 5 | 6 | 17 | 17 | -1 | 0 | 4
1520+
(11 rows)
1521+
1522+
/* --bdDijkstra-1-to-m-filter */
1523+
SELECT seq, path_seq, end_vid AS end_pid, node, edge, cost, agg_cost
1524+
FROM pgr_bdDijkstra(
1525+
'select id, source, target, cost, reverse_cost from edges',
1526+
6, ARRAY[10, 17]);
1527+
seq | path_seq | end_pid | node | edge | cost | agg_cost
1528+
-----+----------+---------+------+------+------+----------
1529+
1 | 1 | 10 | 6 | 4 | 1 | 0
1530+
2 | 2 | 10 | 7 | 8 | 1 | 1
1531+
3 | 3 | 10 | 11 | 9 | 1 | 2
1532+
4 | 4 | 10 | 16 | 16 | 1 | 3
1533+
5 | 5 | 10 | 15 | 3 | 1 | 4
1534+
6 | 6 | 10 | 10 | -1 | 0 | 5
1535+
7 | 1 | 17 | 6 | 4 | 1 | 0
1536+
8 | 2 | 17 | 7 | 8 | 1 | 1
1537+
9 | 3 | 17 | 11 | 11 | 1 | 2
1538+
10 | 4 | 17 | 12 | 13 | 1 | 3
1539+
11 | 5 | 17 | 17 | -1 | 0 | 4
1540+
(11 rows)
1541+
1542+
/* --bdDijkstra-m-to-1 */
1543+
SELECT * FROM pgr_bdDijkstra(
1544+
'select id, source, target, cost, reverse_cost from edges',
1545+
ARRAY[6, 1], 17);
1546+
seq | path_seq | start_vid | end_vid | node | edge | cost | agg_cost
1547+
-----+----------+-----------+---------+------+------+------+----------
1548+
1 | 1 | 1 | 17 | 1 | 6 | 1 | 0
1549+
2 | 2 | 1 | 17 | 3 | 7 | 1 | 1
1550+
3 | 3 | 1 | 17 | 7 | 8 | 1 | 2
1551+
4 | 4 | 1 | 17 | 11 | 11 | 1 | 3
1552+
5 | 5 | 1 | 17 | 12 | 13 | 1 | 4
1553+
6 | 6 | 1 | 17 | 17 | -1 | 0 | 5
1554+
7 | 1 | 6 | 17 | 6 | 4 | 1 | 0
1555+
8 | 2 | 6 | 17 | 7 | 8 | 1 | 1
1556+
9 | 3 | 6 | 17 | 11 | 11 | 1 | 2
1557+
10 | 4 | 6 | 17 | 12 | 13 | 1 | 3
1558+
11 | 5 | 6 | 17 | 17 | -1 | 0 | 4
1559+
(11 rows)
1560+
1561+
/* --bdDijkstra-m-to-1-filter */
1562+
SELECT seq, path_seq, start_vid AS start_pid, node, edge, cost, agg_cost
1563+
FROM pgr_bdDijkstra(
1564+
'select id, source, target, cost, reverse_cost from edges',
1565+
ARRAY[6, 1], 17);
1566+
seq | path_seq | start_pid | node | edge | cost | agg_cost
1567+
-----+----------+-----------+------+------+------+----------
1568+
1 | 1 | 1 | 1 | 6 | 1 | 0
1569+
2 | 2 | 1 | 3 | 7 | 1 | 1
1570+
3 | 3 | 1 | 7 | 8 | 1 | 2
1571+
4 | 4 | 1 | 11 | 11 | 1 | 3
1572+
5 | 5 | 1 | 12 | 13 | 1 | 4
1573+
6 | 6 | 1 | 17 | -1 | 0 | 5
1574+
7 | 1 | 6 | 6 | 4 | 1 | 0
1575+
8 | 2 | 6 | 7 | 8 | 1 | 1
1576+
9 | 3 | 6 | 11 | 11 | 1 | 2
1577+
10 | 4 | 6 | 12 | 13 | 1 | 3
1578+
11 | 5 | 6 | 17 | -1 | 0 | 4
1579+
(11 rows)
1580+
1581+
/* --bdDijkstra-END */
14731582
ROLLBACK;
14741583
ROLLBACK

0 commit comments

Comments
 (0)