neo4j - Determine the Longest Unidirectional Path in a Directed Disconnected Graph -
I have a disconnected graph in which some nodes can be connected to a variety of multiple unidirectional relationships. It is possible that there are loops in the graph.
How can I determine the length of the longest unidirectional path in my graph? I am trying the following questions without following success:
START n = node (*) MATCH P = N & lt; Path in the form of a collection (P) as MAX (length (P)) AS XLLMB Return Filter (path in path where the length (path) = maximum lamp) in advance
thanks,
about it:
MATCH p = (n) & lt; - [: RELTYPE *] - (M) LENGTH (P) DESC LIMIT 1 by return length (P) order
Keep in mind that depending on the structure and size of your graph, Query can be expensive.
Use 1.9 for Neo4j:
START n = node (*) MATCH P = (N) & lt; - [: RELTYPE *] - (M) Return length (P) Order by lens (P) DESC LIMIT 1
Comments
Post a Comment