Skip to content

Commit 1143c80

Browse files
wifi:)wifi:)
authored andcommitted
(kingOrdering/docqueries) Adding test documentation examples code for pgr_kingOrdering
1 parent b36839d commit 1143c80

4 files changed

Lines changed: 133 additions & 0 deletions

File tree

docqueries/ordering/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
SET(LOCAL_FILES
33
cuthillMckeeOrdering
44
topologicalSort
5+
kingOrdering
56
)
67

78
foreach (f ${LOCAL_FILES})
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
-- CopyRight(c) pgRouting developers
2+
-- Creative Commons Attribution-Share Alike 3.0 License : https://creativecommons.org/licenses/by-sa/3.0/
3+
/* -- q1 */
4+
SELECT * FROM pgr_kingOrdering(
5+
'SELECT id, source, target, cost, reverse_cost FROM edges'
6+
);
7+
8+
/* -- q2 */
9+
CREATE TABLE additional_sample_1(
10+
id SERIAL PRIMARY KEY,
11+
source INTEGER,
12+
target INTEGER,
13+
cost DOUBLE PRECISION,
14+
reverse_cost DOUBLE PRECISION
15+
);
16+
17+
INSERT INTO additional_sample_1 (source, target, cost, reverse_cost) VALUES
18+
(4, 7, 1, 1),
19+
(7, 4, 1, 1),
20+
(7, 9, 1, 1),
21+
(9, 7, 1, 1),
22+
(7, 0, 1, 1),
23+
(0, 7, 1, 1),
24+
(0, 2, 1, 1),
25+
(2, 0, 1, 1),
26+
(2, 5, 1, 1),
27+
(5, 2, 1, 1),
28+
(5, 9, 1, 1),
29+
(9, 5, 1, 1),
30+
(9, 8, 1, 1),
31+
(8, 9, 1, 1),
32+
(9, 1, 1, 1),
33+
(1, 9, 1, 1),
34+
(5, 1, 1, 1),
35+
(1, 5, 1, 1),
36+
(9, 6, 1, 1),
37+
(6, 9, 1, 1),
38+
(6, 3, 1, 1),
39+
(3, 6, 1, 1),
40+
(1, 3, 1, 1),
41+
(3, 1, 1, 1);
42+
43+
SELECT * FROM pgr_kingOrdering(
44+
'SELECT id, source, target, cost, reverse_cost FROM additional_sample_1'
45+
);
46+
47+
/* -- q3 */
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
BEGIN;
2+
BEGIN
3+
SET client_min_messages TO NOTICE;
4+
SET
5+
/* -- q1 */
6+
SELECT * FROM pgr_kingOrdering(
7+
'SELECT id, source, target, cost, reverse_cost FROM edges'
8+
);
9+
seq | node
10+
-----+------
11+
1 | 13
12+
2 | 14
13+
3 | 2
14+
4 | 4
15+
5 | 1
16+
6 | 9
17+
7 | 3
18+
8 | 8
19+
9 | 5
20+
10 | 7
21+
11 | 12
22+
12 | 6
23+
13 | 11
24+
14 | 17
25+
15 | 10
26+
16 | 16
27+
17 | 15
28+
(17 rows)
29+
30+
/* -- q2 */
31+
CREATE TABLE additional_sample_1(
32+
id SERIAL PRIMARY KEY,
33+
source INTEGER,
34+
target INTEGER,
35+
cost DOUBLE PRECISION,
36+
reverse_cost DOUBLE PRECISION
37+
);
38+
CREATE TABLE
39+
INSERT INTO additional_sample_1 (source, target, cost, reverse_cost) VALUES
40+
(4, 7, 1, 1),
41+
(7, 4, 1, 1),
42+
(7, 9, 1, 1),
43+
(9, 7, 1, 1),
44+
(7, 0, 1, 1),
45+
(0, 7, 1, 1),
46+
(0, 2, 1, 1),
47+
(2, 0, 1, 1),
48+
(2, 5, 1, 1),
49+
(5, 2, 1, 1),
50+
(5, 9, 1, 1),
51+
(9, 5, 1, 1),
52+
(9, 8, 1, 1),
53+
(8, 9, 1, 1),
54+
(9, 1, 1, 1),
55+
(1, 9, 1, 1),
56+
(5, 1, 1, 1),
57+
(1, 5, 1, 1),
58+
(9, 6, 1, 1),
59+
(6, 9, 1, 1),
60+
(6, 3, 1, 1),
61+
(3, 6, 1, 1),
62+
(1, 3, 1, 1),
63+
(3, 1, 1, 1);
64+
INSERT 0 24
65+
SELECT * FROM pgr_kingOrdering(
66+
'SELECT id, source, target, cost, reverse_cost FROM additional_sample_1'
67+
);
68+
seq | node
69+
-----+------
70+
1 | 0
71+
2 | 4
72+
3 | 2
73+
4 | 7
74+
5 | 8
75+
6 | 5
76+
7 | 9
77+
8 | 1
78+
9 | 6
79+
10 | 3
80+
(10 rows)
81+
82+
/* -- q3 */
83+
ROLLBACK;
84+
ROLLBACK

docqueries/ordering/test.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
'files' => [qw(
66
cuthillMckeeOrdering.pg
77
topologicalSort.pg
8+
kingOrdering.pg
89
)]
910
},
1011

0 commit comments

Comments
 (0)