1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
|
BEGIN;
BEGIN
SET client_min_messages TO NOTICE;
SET
/* :file: This file is part of the pgRouting project.
:copyright: Copyright (c) 2017-2026 pgRouting developers
:license: Creative Commons Attribution-Share Alike 3.0 https://creativecommons.org/licenses/by-sa/3.0 */
UPDATE edges SET id = id * 100, source = 1000 * source, target = 1000 * target;
UPDATE 18
UPDATE vertices SET id = id * 1000;
UPDATE 17
SELECT id, source, target, cost, reverse_cost FROM edges;
id | source | target | cost | reverse_cost
------+--------+--------+------+--------------
600 | 1000 | 3000 | 1 | 1
700 | 3000 | 7000 | 1 | 1
400 | 6000 | 7000 | 1 | 1
500 | 10000 | 11000 | 1 | -1
800 | 7000 | 11000 | 1 | 1
1200 | 8000 | 12000 | 1 | -1
1100 | 11000 | 12000 | 1 | -1
1000 | 7000 | 8000 | 1 | 1
1700 | 2000 | 4000 | 1 | 1
1400 | 8000 | 9000 | 1 | 1
1800 | 13000 | 14000 | 1 | 1
1300 | 12000 | 17000 | 1 | -1
1500 | 16000 | 17000 | 1 | 1
1600 | 15000 | 16000 | 1 | 1
900 | 11000 | 16000 | 1 | 1
300 | 10000 | 15000 | -1 | 1
100 | 5000 | 6000 | 1 | 1
200 | 6000 | 10000 | -1 | 1
(18 rows)
SELECT id FROM vertices;
id
-------
1000
2000
3000
4000
5000
6000
7000
8000
9000
10000
11000
12000
13000
14000
15000
16000
17000
(17 rows)
SELECT * FROM pgr_lineGraphFull(
$$SELECT id, source, target, cost FROM edges WHERE id = 1$$
);
NOTICE: No edges found
HINT: SELECT id, source, target, cost FROM edges WHERE id = 1
seq | source | target | cost | edge
-----+--------+--------+------+------
(0 rows)
SELECT * FROM pgr_lineGraphFull(
$$SELECT id, source, target, cost, reverse_cost
FROM edges
WHERE id = 200$$
);
seq | source | target | cost | edge
-----+--------+--------+------+------
1 | 10000 | 6000 | 1 | -200
(1 row)
SELECT * FROM pgr_lineGraphFull(
$$SELECT id, source, target, cost, reverse_cost
FROM edges
WHERE id = 1100$$
);
seq | source | target | cost | edge
-----+--------+--------+------+------
1 | 11000 | 12000 | 1 | 1100
(1 row)
SELECT * FROM pgr_lineGraphFull(
$$SELECT id, source, target, cost, reverse_cost
FROM edges
WHERE id = 100$$
);
seq | source | target | cost | edge
-----+--------+--------+------+------
1 | -1 | 6000 | 1 | 100
2 | 5000 | -1 | 0 | 0
3 | -2 | 5000 | 1 | -100
4 | 6000 | -2 | 0 | 0
(4 rows)
SELECT * FROM pgr_lineGraphFull($$
SELECT id AS id, target, source, reverse_cost AS cost FROM edges WHERE id = 100
UNION
SELECT id, source, target, cost FROM edges WHERE id = 100
$$
);
seq | source | target | cost | edge
-----+--------+--------+------+------
1 | 6000 | 6000 | 1 | 100
2 | 6000 | 5000 | 1 | 100
3 | 5000 | 6000 | 1 | 100
4 | 5000 | 5000 | 1 | 100
(4 rows)
SELECT * FROM pgr_lineGraphFull($$
SELECT id, target, source, reverse_cost AS cost FROM edges WHERE id = 100
UNION
SELECT -id AS id, source, target, cost FROM edges WHERE id = 100
$$
);
seq | source | target | cost | edge
-----+--------+--------+------+------
1 | -1 | 5000 | 1 | -100
2 | 6000 | -1 | 0 | 0
3 | -2 | 6000 | 1 | 100
4 | 5000 | -2 | 0 | 0
(4 rows)
SELECT * FROM pgr_lineGraphFull(
$$SELECT id, source, target, cost, reverse_cost
FROM edges
WHERE id IN (200, 300)$$
);
seq | source | target | cost | edge
-----+--------+--------+------+------
1 | -1 | 6000 | 1 | -200
2 | 10000 | -1 | 0 | 0
3 | 15000 | 10000 | 1 | -300
(3 rows)
SELECT * FROM pgr_lineGraphFull(
$$SELECT id * 100 AS id, source * 1000 AS source, target * 1000 AS target,
cost, reverse_cost
FROM edges
WHERE id in (600, 700)$$
);
seq | source | target | cost | edge
-----+---------+---------+------+--------
1 | -1 | 3000000 | 1 | 60000
2 | 1000000 | -1 | 0 | 0
3 | -2 | 1000000 | 1 | -60000
4 | -3 | 7000000 | 1 | 70000
5 | 3000000 | -2 | 0 | 0
6 | 3000000 | -3 | 0 | 0
7 | -4 | -2 | 0 | 0
8 | -4 | -3 | 0 | 0
9 | -5 | -4 | 1 | -70000
10 | 7000000 | -5 | 0 | 0
(10 rows)
SELECT * FROM pgr_lineGraphFull(
$$SELECT id * 100 AS id, source * 1000 AS source, target * 1000 AS target,
cost, reverse_cost
FROM edges
where id in (500, 900, 1100)$$
);
seq | source | target | cost | edge
-----+----------+----------+------+--------
1 | 10000000 | 11000000 | 1 | 50000
2 | -1 | 12000000 | 1 | 110000
3 | -2 | 16000000 | 1 | 90000
4 | 11000000 | -1 | 0 | 0
5 | 11000000 | -2 | 0 | 0
6 | -3 | -1 | 0 | 0
7 | -3 | -2 | 0 | 0
8 | -4 | -3 | 1 | -90000
9 | 16000000 | -4 | 0 | 0
(9 rows)
ROLLBACK;
ROLLBACK
|