我需要转换此查询以与c#中的graphclient一起使用:
MATCH p=(n)-[r*2..10]-(m)
WHERE n.Id = 94 and m.Id = 94
AND NONE (node IN NODES(p) WHERE SIZE(
FILTER(x IN NODES(p) WHERE node = x AND x.Id <> 94)
) > 1
)
RETURN EXTRACT(n IN NODES(p)| n.Id) AS Paths, length(p), r
order by length(p)
答案 0 :(得分:0)
我可以提出的最接近的解决方案是:
var results = neoDB.Cypher
.Match("p=(n:JUNCTIONS)-[r*2..10]-(m:JUNCTIONS)")
.Where("n.Id={startNodeId} and m.Id={endNodeId}")
.WithParam("startNodeId", 92)
.WithParam("endNodeId", 92)
.Return((p, n, m, r) => new
{
path = p.CollectAs<Neo4jClient.ApiModels.Cypher.PathsResult>(),
node1 = n.As<cNode>(),
node2 = m.As<cNode>(),
Relation = r.As<IEnumerable<cNode>>()
}).Results;
长度大于1的过滤器是不必要的,此解决方案对我有好处