How can I specify which relationship type to use as a function of the current node at every step of a traversal with neo4j?

纵饮孤独 提交于 2019-12-10 19:04:36

问题


I'd like to traverse my graph using the neo4j traversal API, but I need to be able to specify which relationship type to use at every step, and the relationship type to use needs to be a function of the current node. Is there a way to do this?


回答1:


in the current Traverser API you can't choose the exact relationship to traverse. Instead, you take the more granular approach of node.getRelationships(), chose the one you want and the end onde on it, and so on. The algo gets a bit more verbose than using Traverser, but gives you more flexibility. For a tinkering approach, Gremlin supports the notion of functions for choosing edges to traverse, see here. This will soon be implemented using Blueprint Pipes for Java-level performance.

HTH

/peter neubauer



来源:https://stackoverflow.com/questions/2430196/how-can-i-specify-which-relationship-type-to-use-as-a-function-of-the-current-no

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!