我试图在两个顶点上搜索最短路径。
但是,在哑剧上查询的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})...
不可能在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)
如果不可能,请使用" were"子句而不是属性约束。
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)