Neo4j cypher query display tree-like subgraph starting from one node without specific sequence of relations and nodes (as efficent as possible)

后端 未结 2 1820
面向向阳花
面向向阳花 2021-01-23 04:10

I want to Display a tree-like subgraph showing all paths starting from a single node. Most connections are bidirectional(2 edges at the moment probably change to 1 edge instead

2条回答
  •  轮回少年
    2021-01-23 04:58

    For this you should create a custom traversal. There is an API for that in Neo4j, take a look at the documentation : https://neo4j.com/docs/java-reference/current/#tutorial-traversal

    To not traverse twice a node, you should use the NODE_PATH as uniqueness rule (in cypher, it's a RELATIONSHIP_PATH uniqueness to avoid graph cycle).

    Cheers

提交回复
热议问题