0

我试图在两个顶点上搜索最短路径。

但是,在 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})...
4

1 回答 1

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)
于 2019-02-25T01:53:34.677 回答