cancel
Showing results for 
Search instead for 
Did you mean: 

Join the community at Nodes 2022, our free virtual event on November 16 - 17.

Neo.ClientError.Statement.SyntaxError

IchsanALi
Node Link
// Find maximum diameter of network
// maximum shortest path between two nodes
MATCH (a:Character), (b:Character) WHERE id(a) > id(b)
MATCH p=shortestPath((a)-[:INTERACTS*]-(b))
RETURN length(p) AS Length, extract(IN nodes(p) | x.name) AS Path
ORDER BY len DESC LIMIT 4
 
Neo.ClientError.Statement.SyntaxError
Extract is no longer supported. Please use list comprehension instead (line 5, column 29 (offset: 206))
"RETURN length(p) AS Length, extract(x IN nodes(p) | x.name) AS Path"
1 ACCEPTED SOLUTION

glilienfield
Ninja
Ninja

Try this:

 
match(a:Character)
match(b:Character)
where id(a) > id(b)
match p=shortestPath((a)-[:INTERACTS*]-(b))
return length(p) as Length, [x in nodes(p) | x.name] as Path
order by Length desc
limit 4

View solution in original post

2 REPLIES 2

glilienfield
Ninja
Ninja

Try this:

 
match(a:Character)
match(b:Character)
where id(a) > id(b)
match p=shortestPath((a)-[:INTERACTS*]-(b))
return length(p) as Length, [x in nodes(p) | x.name] as Path
order by Length desc
limit 4

thank you very much,
can run

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit - November 16 - 17, 2022.


Free NODES Training Series


October 19th -

Intro to Neo4j


October 20th -

Healthcare Analytics Using Neo4j


October 25th -

Handling Neo4j data with Apache Hop


October 26th -

Blazing Fast Graphs: Hands-on with Apache Arrow and Neo4j


November 2nd -

Graph EDA Using the Neo4j GDS Client