[英]Match doesn't found shortest paths
我有任务 我有很多观点。 我知道时间,这需要花费一点时间。 对我来说,建议使用neo4j搜索最短路径。 首先,我在c#点中创建:
public bool AddPoint(Point point)
{
bool sucess = false;
try
{
client.Cypher
.Create("(point:Point {newPoint})")
.WithParam("newPoint", point)
.ExecuteWithoutResults();
sucess = true;
Console.WriteLine("The point was added!");
}
catch (Exception exception)
{
Console.WriteLine("Error! " + exception);
}
return sucess;
}
第二个功能链接两点:
public void LinkTwoPoint(string firstName, string secondName, string time)
{
try
{
client.Cypher
.Match("(point1:Point)", "(point2:Point)")
.Where((Point point1) => point1.Name == firstName)
.AndWhere((Point point2) => point2.Name == secondName)
.Create(string.Format("point1-[r:Time{0}time:{1}{2}]->point2","{", time,"}"))
.ExecuteWithoutResults();
Console.WriteLine("Ok. Point was connected!");
}
catch (Exception exception)
{
Console.WriteLine("Error! " + exception);
}
}
但是,当我尝试搜索最短路径(在浏览器中查询。这不是C#代码)时,系统找不到任何内容:
MATCH (pointStart:Point { name:"Point_B" }),(pointEnd:Point { name:"Point_E" }),
p = allShortestPaths((pointStart)-[*]-(pointEnd))
RETURN p
您可以提出任何解决方案的建议吗?
PS执行此查询后:
MATCH (pointStart:Point { name:"Point_B" })-[r]-(pointEnd:Point { name:"Point_E" })
RETURN pointStart, pointEnd, r
没有建立行。
首先,尝试以下查询
MATCH (pointStart:Point { name:"Point_B" })-[r]-(pointEnd:Point { name:"Point_E" })
RETURN pointStart, pointEnd, r
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.