0

我正在使用从 Eclipse 中嵌入的 Neo4j,并希望通过旅行和车站网络进行导航。它们通过以下方式连接:

(t:Trip)-[:STOPS {arrival:"10:12:00", departure:"10:13:00"}]->(s:Station)

由于一次旅行有几个站点,并且有几个旅行在一个站点停止,因此有许多连接。有时,如果不改变不同的行程,就不可能从一个车站到达另一个车站。出于这个原因,我使用下面的图形算法

    PathFinder<Path> finder = GraphAlgoFactory.shortestPath(PathExpanders.forType(RelTypes.STOPS), depth);
    ArrayList<Path> path = (ArrayList<Path>) finder.findAllPaths(source,target);

但是我找不到是否有方法可以过滤我的属性arrivaldeparture因为我只想找到在给定时间之后离开的旅行。

4

1 回答 1

0

而不是PathExpanders.forType()您需要使用您的自定义实现PathExpander

您的实现基本上会过滤path.endNode().getRelationships(RelTypes.STOPS)那些具有正确到达和离开属性的人。

于 2015-07-24T19:28:35.083 回答