Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loss of contracted vertex information in linear contraction. #1006

Closed
rohithsankepally opened this issue Mar 9, 2018 · 2 comments
Closed

Comments

@rohithsankepally
Copy link
Contributor

Sample data is used to demonstrate this bug.

Expected Behavior

SELECT * FROM pgr_contractGraph(
    'SELECT id, source, target, cost FROM edge_table
    WHERE id = ANY(ARRAY[8, 9, 11, 13]) AND cost > 0 
    UNION
    SELECT id, target, source, reverse_cost FROM edge_table
    WHERE id = ANY(ARRAY[15, 16]) AND reverse_cost > 0',
    ARRAY[2]::integer[], 1, ARRAY[]::BIGINT[], true);
 seq | type | id | contracted_vertices | source | target | cost
-----+------+----+---------------------+--------+--------+------
   1 | e    | -5 | {6, 9}              |      5 |     4  |    3
   2 | e    | -6 | {6, 9, 11, 12}      |      5 |     4  |    5
(2 rows)

Actual Behavior

SELECT * FROM pgr_contractGraph(
    'SELECT id, source, target, cost FROM edge_table
    WHERE id = ANY(ARRAY[8, 9, 11, 13]) AND cost > 0 
    UNION
    SELECT id, target, source, reverse_cost FROM edge_table
    WHERE id = ANY(ARRAY[15, 16]) AND reverse_cost > 0',
    ARRAY[2]::integer[], 1, ARRAY[]::BIGINT[], true);
 seq | type | id | contracted_vertices | source | target | cost
-----+------+----+---------------------+--------+--------+------
   1 | e    | -1 | {11}                |      6 |     12 |    2
   2 | e    | -2 | {11,12}             |      6 |      9 |    3
   3 | e    | -3 | {6}                 |      5 |      9 |    2
   4 | e    | -4 | {6,9}               |      5 |      4 |    3
(4 rows)

It can be noticed that the shortcuts added from vertex 5 to vertex 4 do not store the contracted vertices 11 and 12.

@cvvergara
Copy link
Member

I wonder if you can draw this graph, because even that it comes from the sample data, its not quite the same:

SELECT id, source, target, cost FROM edge_table
    WHERE id = ANY(ARRAY[8, 9, 11, 13]) AND cost > 0 
    UNION
    SELECT id, target, source, reverse_cost FROM edge_table
    WHERE id = ANY(ARRAY[15, 16]) AND reverse_cost > 0'

FYI: you have the link to the sample data from version 2.3 when we are on 2.5

@cvvergara
Copy link
Member

Related to #1002

@dkastl dkastl added this to the Release 2.7.0 milestone Mar 20, 2018
@cvvergara cvvergara removed this from the Release 2.7.0 milestone Sep 18, 2018
cvvergara added a commit to cvvergara/pgrouting that referenced this issue Jun 5, 2019
…gRouting#1006

* changing NEWS and release notes
	modified:   NEWS
	modified:   doc/src/release_notes.rst

* Adding a unit test for testing the issues
	new file:   pgtap/contraction/issue1002/issue1002.sql
	modified:   test/contraction/test.conf
@cvvergara cvvergara added this to the Release 3.0.0 milestone Dec 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants