For example
MATCH path = shortestPath((s {
http://dbpedia.org/ontology/uri`:"http://identifiers.org/uniprot/P0DTC2-PRO_0000449649"})-[*]-(humanprot)) WHERE humanprot.http://dbpedia.org/ontology/uri
IN ["http://identifiers.org/hgnc/15022"] RETURN path`
finishes in about a second, while
MATCH (s {
http://dbpedia.org/ontology/uri`:"http://identifiers.org/uniprot/P0DTC2-PRO_0000449647"})-[*]-(humanprot) WHERE humanprot.http://dbpedia.org/ontology/uri
IN ["http://identifiers.org/hgnc/15022"] RETURN * LIMIT 1`
runs for ages and is still running while I am writing this.
Why if I remove the shortestPath() function from the query and put there LIMIT 1 instead, it becomes suddenly so much more complicated? Intuitively, it seems that finding any path should be faster than finding shortest path.