This PR introduces the path-finding operator developed by Pingan Ren during his MSc thesis.
It doesn't work with the PGQ syntax yet but will be added in future commits.
The operator needs to be enabled with a SET command:
set experimental_path_finding_operator=true;
Getting the current setting's value:
SELECT current_setting('experimental_path_finding_operator');
This PR is limited to unquantified shortest path and path length queries with a * in PGQ.
An example that will trigger the operator:
CREATE TABLE pair(src BIGINT, dst BIGINT); INSERT INTO pair(src, dst) VALUES (0, 1), (1, 2), (2,0);
CREATE TABLE student(id INT); INSERT INTO student(id) VALUES (10), (20), (30), (40);
CREATE TABLE know(src INT, dst INT); INSERT INTO know(src, dst) VALUES (40, 20), (10,30), (10,10), (20,10), (30,10);
WITH shortestpath_cte as (
SELECT src, dst, shortestpathoperator(src, dst, 'pair') as path
FROM pair p
WHERE p.src between (SELECT CSR_OPERATOR(
(SELECT count(a.id) as v_size FROM Student a),
(SELECT count(k.src) as e_size from know k),
a.rowid,
c.rowid,
k.rowid,
t.cnt) FROM Know k
JOIN student a on a.id = k.src
JOIN student c on c.id = k.dst
JOIN (SELECT count(k.src) cnt, a.rowid as a_rowid
FROM student a
LEFT JOIN know k ON k.src = a.id
GROUP BY a.rowid) t
ON t.a_rowid = a.rowid) and p.dst)
SELECT * FROM shortestpath_cte;
This PR also supports the PGQ syntax:
FROM GRAPH_TABLE (pg
MATCH p = ANY SHORTEST (a:Person)-[k:Knows]-> *(b:Person) COLUMNS (element_id(p)));
This PR will only support ANY SHORTEST with * (shortest unbounded path patterns). A future PR will add support for shortest path with quantified path patterns and +.
This PR introduces the path-finding operator developed by Pingan Ren during his MSc thesis.
It doesn't work with the PGQ syntax yet but will be added in future commits.
The operator needs to be enabled with a
SET
command:set experimental_path_finding_operator=true;
Getting the current setting's value:SELECT current_setting('experimental_path_finding_operator');
This PR is limited to unquantified shortest path and path length queries with a
*
in PGQ.An example that will trigger the operator:
This PR also supports the PGQ syntax:
This PR will only support ANY SHORTEST with
*
(shortest unbounded path patterns). A future PR will add support for shortest path with quantified path patterns and+
.