我正在使用从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);
但我无法找到是否有办法过滤我的属性arrival
和departure
,因为我只想查找在给定时间后离开的行程。
答案 0 :(得分:0)
而不是PathExpanders.forType()
,您需要使用PathExpander
的自定义实现。
对于那些具有正确到达和离开属性的人,您的实施基本上会过滤path.endNode().getRelationships(RelTypes.STOPS)
。