我试图在两个顶点上搜索最短路径。
但是,在mime上进行CYPHER查询时出错。
如何找到顶点之间的最短路径?
agens (AgensGraph 1.3.1, based on PostgreSQL 9.6.2)
Type "help" for help.
agens =# match p = shortestpath( (l1:l{id:1})-[:e*]->(l2:l{id:11111}) ) return nodes(p);
ERROR: property constraint is not supported
LINE 1: match p = shortestpath( (l1:l{id:1})-[:e*]->(l2:l{id:11111})...
答案 0 :(得分:0)
不可能在较旧版本的AgensGraph上使用属性约束。
请考虑升级AgensGraph版本。
agens (AgensGraph 2.1.0, based on PostgreSQL 10.4)
Type "help" for help.
agens =# match p = shortestpath( (l1:l{id:1})-[:e*]->(l2:l{id:11111}) ) return nodes(p);
nodes
----------------------------------------------------------------------------------------------------
[l[4.1]{"id": 1},l[4.10]{"id": 11},l[4.91]{"id": 111},l[4.820]{"id": 1111},l[4.7381]{"id": 11111}]
(1 row)
如果不可能,请使用“ WHERE”子句代替属性约束。
agens (AgensGraph 1.3.1, based on PostgreSQL 9.6.2)
Type "help" for help.
agens =# match p = shortestpath( (l1:l)-[:e*]->(l2:l) ) where l1.id = 1 and l2.id = 11111 return nodes(p);
nodes
----------------------------------------------------------------------------------------------------
[l[4.1]{"id": 1},l[4.10]{"id": 11},l[4.91]{"id": 111},l[4.820]{"id": 1111},l[4.7381]{"id": 11111}]
(1 row)