我的Cypher看起来像这样:
START source=node(16822), target=node(12449)
MATCH p = allShortestPaths(source-[*]-target)
return p
我想为此编写等效的C#代码。这就是我到现在为止所做的事情
var query = client.Cypher
.Start(new { source = sourceNode.Reference, target = targetNode.Reference })
.Match("p = allShortestPaths(source-[*]-target)")
.Return<Node<Data>>("x");
其中Data是具有字符串属性的类(字符串ID)。
我应该用什么来代替x来将我的结果作为包含路径的连接ID列表。
答案 0 :(得分:1)
Cypher 2.0
START source=node(16822), target=node(12449)
MATCH p = allShortestPaths(source-[*]-target)
return nodes(p)
答案 1 :(得分:0)
执行查询的好方法是我使用
的最后手段CypherQuery query1 = new CypherQuery(@"START m=node(" + sourceNode.Reference.Id.ToString() + "), n=node(" + targetNode.Reference.Id.ToString() + @")
match p = allshortestpaths(m-[*]-n)
return distinct Extract(x in NODES(p): x.NodeId) as paths", paramCollection, CypherResultMode.Set);
var paths = ((IRawGraphClient)client).ExecuteGetCypherResults<List<string>>(query1);