2

我可以成功使用以下查询“In Degree”:

match a=(p:Person)-->(q:Person{Address:'0xa1e4380a3b1f749673e270229993ee55f35663b4'})
RETURN count(a) as In_Degree

我可以成功使用以下查询“Out Degree”:

match a=(p:Person)<--(q:Person{Address:'0xa1e4380a3b1f749673e270229993ee55f35663b4'})
RETURN count(a) as Out_Degree

但是,当我将两者结合起来并编写如下查询时,Cypher 给出的结果是“Out Degree”。

match a=(p:Person)-->(q:Person{Address:'0xa1e4380a3b1f749673e270229993ee55f35663b4'}),b=(r:Person)<--(s:Person{Address:'0xa1e4380a3b1f749673e270229993ee55f35663b4'})
RETURN count(a) as In_Degree, count(b) as Out_Degree

我在这里错过了什么吗?有人可以帮我解决这个问题吗?

4

1 回答 1

3

你可以试试这个查询:

MATCH (p:Person{Address:'0xa1e4380a3b1f749673e270229993ee55f35663b4'})
RETURN size((p)<--(:Person)) AS In_Degree, size((p)-->(:Person)) AS Out_Degree

干杯。

于 2017-08-29T10:37:36.490 回答