duckpgq-extension icon indicating copy to clipboard operation
duckpgq-extension copied to clipboard

Test if bounded path lengths get correct results

Open Dtenwolde opened this issue 1 year ago • 2 comments

The way bounded paths are currently checked is with a post-op filter: iterativelength(0, (select count(*) from Person), a.rowid, b.rowid) between 2 and 3 In this case, if the shortest path length is found to be between 2 and 3 hops, it evaluates to true. However, there might be cases in the graph where the shortest path is 1 (a), and a path with length 2 or 3 (b) does exist. In this case, that result (b) should then be returned to the user. However, since the shortest path was found to be 1, and is below the lower bound, it is left out.

The goal of this issue is to verify that this is indeed the case. This can be done by creating a toy graph example with this case present. If it does exist, we should probably push the bound filter to the UDF, to ensure the paths with proper length are correctly evaluated.

Dtenwolde avatar Jan 12 '24 08:01 Dtenwolde

The issue does exist.

Reproduce test case:

CREATE TABLE Point(id BIGINT); INSERT INTO Point VALUES (0), (1), (2), (3);
CREATE TABLE know(src BIGINT, dst BIGINT); INSERT INTO know VALUES (0, 1), (0, 2), (2, 3), (3, 1);
-CREATE PROPERTY GRAPH pg
VERTEX TABLES (
    Point PROPERTIES ( id ) LABEL Pnt
    )
EDGE TABLES (
    know    SOURCE KEY ( src ) REFERENCES Point ( id )
            DESTINATION KEY ( dst ) REFERENCES Point ( id )
            LABEL Knows
    );
-FROM GRAPH_TABLE (pg
    MATCH
    p = ANY SHORTEST (a:Pnt WHERE a.id = 0)-[k:knows]->{2,3}(b:Pnt WHERE b.id = 1)
    COLUMNS (element_id(p))
    ) x;

Expected output: [0, 0, 1] Troubled output: 0 rows

SiberiaWolfP avatar Feb 06 '24 12:02 SiberiaWolfP

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Sep 04 '24 00:09 github-actions[bot]