简体   繁体   English

匹配找不到最短路径

[英]Match doesn't found shortest paths

I have task. 我有任务 I have array of point. 我有很多观点。 I know time, which need spent to go from one point to second. 我知道时间,这需要花费一点时间。 For me reccomended use neo4j to search shortest path . 对我来说,建议使用neo4j搜索最短路径。 First I create in c# point(s): 首先,我在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;
}

Second function link two points: 第二个功能链接两点:

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);
            }
        }

But when I try search shortest path (query in browser. This is not c# code), the system doesn't found anything: 但是,当我尝试搜索最短路径(在浏览器中查询。这不是C#代码)时,系统找不到任何内容:

MATCH (pointStart:Point { name:"Point_B" }),(pointEnd:Point { name:"Point_E" }),
  p = allShortestPaths((pointStart)-[*]-(pointEnd))
RETURN p

Can you suggest anything to fix it? 您可以提出任何解决方案的建议吗?

PS After execute this query: PS执行此查询后:

MATCH (pointStart:Point { name:"Point_B" })-[r]-(pointEnd:Point { name:"Point_E" })
RETURN pointStart, pointEnd, r

No rows was founded. 没有建立行。

在此处输入图片说明

First, try following query 首先,尝试以下查询

MATCH (pointStart:Point { name:"Point_B" })-[r]-(pointEnd:Point { name:"Point_E" })
RETURN pointStart, pointEnd, r

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM