Last active
October 18, 2017 13:33
-
-
Save vidhan13j07/0eea1639de7be70a12a8eef626f511e2 to your computer and use it in GitHub Desktop.
This gist contains the sample queries used in the LineGraph presentation: https://docs.google.com/presentation/d/1TTSvKvF-a6P1WD_Aezc541vUHsoCUAQXMOfnBX3orcU/edit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP TABLE IF EXISTS edge_table; | |
CREATE TABLE edge_table ( | |
id BIGSERIAL, | |
source BIGINT, | |
target BIGINT, | |
cost FLOAT, | |
reverse_cost FLOAT | |
); | |
INSERT INTO edge_table ( | |
source, target, | |
cost, reverse_cost) VALUES | |
(5, 6, 1, 1), (2, 5, 1, 1), | |
(3, 6, 1, -1), (3, 2, 1, -1); | |
SELECT * FROM pgr_lineGraph ( | |
'SELECT id, source, target, cost, reverse_cost FROM edge_table'); | |
/*************OUTPUT********************************** | |
seq | source | target | cost | reverse_cost | |
-----+--------+--------+------+-------------- | |
1 | 2 | 1 | 1 | 1 | |
2 | 3 | -1 | 1 | -1 | |
3 | 4 | 2 | 1 | -1 | |
(3 rows) | |
*************************************/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment