1

我有包含数百万个节点和关系的大图。我需要找到 <= 5 箍的节点组之间所有可能的关系。 示例: GroupA { Node1, Node2, Node3, .. Node100} 具有 100 个节点的节点组。

现在我想找到所有这些节点之间所有可能的关系。

当我运行包含 100 个节点的 Cypher Query 时,一切正常,但是当我使用 101 个节点运行它时,我得到了 TimeOut。(所有请求都是 REST)

 {
        "query": "start s = node(114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214), d = node(114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214)  match p = s -[r?*0..5]-> d return p  ",
        "params": {}
    }

有人可以解释一下会发生什么吗?错误查询??

更新: 发现的另一个问题:当我在循环中运行 200 个密码查询时,服务器在查询编号 100 后停止响应

Something like that 
for (i=0; i<200; i++)
{
  query = "start s = node(" + sourceNodeId + "), d = node(" + destinationNodeid + ")  match p = s -[r?*0.." + deep + "]-> d return p"
   RunCypherQuery(query);
}

什么可能导致这种奇怪的行为?10倍

更新:

我进行了内存调整并将 JavaMemory Min 和 Max 增加到 4G 而不是 4M 和 64M 结果是异常:

Error 500 GC overhead limit exceeded
HTTP ERROR 500
Problem accessing /db/data/cypher. 
Reason:
GC overhead limit exceeded</pre></p><h3>Caused by:</h3><pre>java.lang.OutOfMemoryError: GC overhead limit exceeded
    at scala.collection.JavaConversions$.mapAsScalaMap(JavaConversions.scala:488)
    at scala.collection.JavaConverters$$anonfun$mapAsScalaMapConverter$1.apply(JavaConverters.scala:441)
    at scala.collection.JavaConverters$$anonfun$mapAsScalaMapConverter$1.apply(JavaConverters.scala:441)
    at scala.collection.JavaConverters$AsScala.asScala(JavaConverters.scala:80)
    at org.neo4j.cypher.internal.pipes.MutableMaps$.create(Pipe.scala:60)
    at org.neo4j.cypher.internal.pipes.ExecutionContext.newWith(Pipe.scala:136)
    at org.neo4j.cypher.internal.pipes.matching.AddedHistory.toMap(History.scala:75)
    at org.neo4j.cypher.internal.pipes.matching.PatternMatcher.isMatchSoFar(PatternMatcher.scala:166)
    at org.neo4j.cypher.internal.pipes.matching.PatternMatcher.org$neo4j$cypher$internal$pipes$matching$PatternMatcher$$traverseNextNodeFromRelationship(PatternMatcher.scala:98)
    at org.neo4j.cypher.internal.pipes.matching.PatternMatcher$$anonfun$4.apply(PatternMatcher.scala:150)
    at org.neo4j.cypher.internal.pipes.matching.PatternMatcher$$anonfun$4.apply(PatternMatcher.scala:150)
    at scala.collection.immutable.Stream$$anonfun$map$1.apply(Stream.scala:175)
    at scala.collection.immutable.Stream$$anonfun$map$1.apply(Stream.scala:175)
    at scala.collection.immutable.Stream$Cons.tail(Stream.scala:634)
    at scala.collection.immutable.Stream$Cons.tail(Stream.scala:626)
    at scala.collection.immutable.Stream.foldLeft(Stream.scala:302)
    at org.neo4j.cypher.internal.pipes.matching.PatternMatcher.traverseRelationship(PatternMatcher.scala:150)
    at org.neo4j.cypher.internal.pipes.matching.PatternMatcher.traverseNextSpecificNode(PatternMatcher.scala:61)
    at org.neo4j.cypher.internal.pipes.matching.PatternMatcher.traverseNode(PatternMatcher.scala:72)
    at org.neo4j.cypher.internal.pipes.matching.PatternMatcher.traverseNextNodeOrYield(PatternMatcher.scala:177)
    at org.neo4j.cypher.internal.pipes.matching.PatternMatcher.traverseNextSpecificNode(PatternMatcher.scala:60)
    at org.neo4j.cypher.internal.pipes.matching.PatternMatcher.traverseNode(PatternMatcher.scala:72)
    at org.neo4j.cypher.internal.pipes.matching.PatternMatcher.foreach(PatternMatcher.scala:36)
    at scala.collection.TraversableLike$class.map(TraversableLike.scala:194)
    at org.neo4j.cypher.internal.pipes.matching.PatternMatcher.map(PatternMatcher.scala:28)
    at org.neo4j.cypher.internal.pipes.matching.PatterMatchingBuilder.org$neo4j$cypher$internal$pipes$matching$PatterMatchingBuilder$$createPatternMatcher(PatterMatchingBuilder.scala:90)
    at org.neo4j.cypher.internal.pipes.matching.PatterMatchingBuilder$$anonfun$getMatches$1.apply(PatterMatchingBuilder.scala:47)
    at org.neo4j.cypher.internal.pipes.matching.PatterMatchingBuilder$$anonfun$getMatches$1.apply(PatterMatchingBuilder.scala:47)
    at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:200)
    at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:200)
    at org.neo4j.cypher.internal.pipes.matching.PatternMatcher.yieldThis(PatternMatcher.scala:185)
    at org.neo4j.cypher.internal.pipes.matching.PatternMatcher.traverseNextNodeOrYield(PatternMatcher.scala:175)
4

2 回答 2

1

我想你的问题可能有点不清楚。您想返回所有已连接对的列表吗?如果是这样,这是一个 Cypher 查询,它将返回所有对:

START a=node(*) 
MATCH p=a-[*1..5]->b 
RETURN distinct p
于 2013-06-06T00:52:46.900 回答
-1

我同意 Nicholas 的观点,您应该尝试使用 Cypher,您也可以通过 REST API 发送(参见此处)。

尝试

START n=node(1,2,3), m=node(1,2,3)
MATCH n-[?*..4]->()-[r]->m
RETURN DISTINCT r;

当然替换(1,2,3)为您的 100 个节点 ID 的长列表!如果我理解正确的话,这就是你要找的东西!

于 2013-06-06T09:46:01.140 回答