Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
04-01-2021 07:14 PM
Hi,
I'm start to learning about neo4j.(4.2.1 enterprise)
I want to know why this syntax dose not working.
MATCH (from:Point {name:"10000148386"}), (to:Point{name:"10000089111"}), path=((from)-[*..20]->(to))
RETURN from, to, path
I would like to search shortest path Point to Point by name.
but avobe syntax does not work(no changes no records)
I have tried below syntax. That's working.(ID 15231 is 10000148386, ID 7314 is 10000089111)
MATCH (from:Point),(to:Point), p = shortestPath((from)-[*..20]-(to)) WHERE id(from) = 15231 AND id(to) = 7314 RETURN p
If you have any idea please let me know.
04-02-2021 04:39 AM
Hello,
On a similar graph I have, both queries work - and there's no reason why this shouldn't work.
So, the only explanation I have is : are you certain that your :Point nodes have a property name which is of type string ?
As your name property is made only of numbers, maybe you set the property as an Integer instead of as a String.
Try the same query without the quotes on the name filter ?
By the way, my advice would be to write the query this way (it's more compact, and you prevent a match on a cartesian product :
MATCH path=shortestPath((from:Point {name:10000148386})-[*..20]->(to:Place{name:10000089111}))
RETURN path
Note : See how I filter the property as Integer here instead of String
04-05-2021 03:16 AM
Hello marius-san,
Thank you four your advice.
I imported Point name as strings.so i will try to import as integer.
and thanks for improve my syntax!
All the sessions of the conference are now available online