Yes, cypher can do all of those things.
Range queries look something like this:
MATCH path=(a:MyNode { name: "Foo"})-[:myRelationshipType*1..20]->(b));
That gives you all "b" nodes that are between 1 and 20 hops from MyNode with the given relationship type. The matched path is a variable, which can have various cypher functions applied to it. So for each path, you can ask how long it is, what's in the middle, and so on. The cypher refcard shows functions that apply to paths to get a sense for what you can do with them.
Shortest-path searches can be found here and use the shortestPath
and allShortestPaths
functions in cypher.
If you wanted to get the shortest path from something to basically everything else in the graph, you could do that in one query; the shortest path would start with matching a "head" node, and a "tail" node. In the case of finding shortest path from one thing to everything else, the head node match would be your node of interest, and the tail node match would be "any node in the graph". E.g. MATCH (a:MyNodeOfInterest), (b), p=shortestPath((a)-[*]->(b))
. So you could do this in one query, but, if you're trying to find shortest paths from one thing to everything else in a one million node graph, that's going to take some time, no matter what graph database you use.
In terms of performance, nobody can really accurately answer that question. It will depend on a lot of different factors like:
- Total data volumes
- Indexing strategy
- Your use/abuse of node labels, and relationship types
- Total path lengths
- JVM/memory/cache configurations.