2

I have two types nodes in my graph. 70k ARTICLE, 10k DOCTOR and 20K relationships between the nodes. I want to query all the shortest path in the graph and then filt the longest 2 path. But there is Cartesian product in the query plan and the performance is too low...My cypher query is as below:

Match p = shortestPath( (a:DOCTOR)-[n:IS_AUTHOR*1..]-(b:DOCTOR) )
with a,b,p,length(p) AS length
order by length(p) DESC limit 3
RETURN nodes(p)

Is there anything I can do to tune the performance when using global graph query? This is my query plan:query plan

L.Leo
  • 91
  • 1
  • 1
  • 3
  • 1
    Can you clarify what you're trying to do? The query is finding the shortest paths between every single combinations of doctors using the kind of path given. Is this what you want? If so, I don't think you can avoid a cartesian product. But if you are instead trying to get, for each doctor, the shortest path to the closest doctor on that path, and then trying to find the doctors with the longest paths to some other doctor, that's an entirely different query...I don't think that's one you can accomplish with the shortest path function. – InverseFalcon Aug 09 '16 at 19:05

0 Answers0