I have a graph with 0.5 billion nodes and edges in Neo. I want to find the shortest path between two nodes that avoids supernovae (even if it is longer than the paths that have supernodes).
The following query works fine for smaller graphs, but never ends for the size graph I'm dealing with:
MATCH (n:Node { id:'123'}),(m:Node { id:'234' }), p = shortestPath((n)-[*..6]-(m)) WHERE NONE(x IN NODES(p) WHERE size((x)--())>1000) RETURN p
If I delete the WHERE clause, it is very fast. Usually a subsecond.
How can I speed it up? Would predict node degrees and index their help? Should I resort to duplicating all edges except adjacent to the super-nodes, giving them a new label and using them for my shortest request without a WHERE clause? Any other suggestions?
source share