Query on relationships with Cypher

Hi. I'm learning neo4j and I have to make a simple query, but I'm not able to make it.
Suppose to have the graph below.
I want to return all the nodes connected to the node A
and the maximum of the values on the edges between two consecutive nodes(which is an attribute of the relation). I show an example in the picture below.

I did it for path of length one with this query:

MATCH (p {id:"A"})<-[r:HAS]-(t)
RETURN p,max(r.value),t

But I don't know how to make a query for a path longer than one, just because I can't do

MATCH (p {id:"A"})<-[r:HAS*]-(t)
RETURN p,max(r.value),t

I got this error : Type mismatch: expected Map, Node, Relationship, Point, Duration, Date, Time, LocalTime, LocalDateTime or DateTime but was List
query
query1

Hello Cobra.
Thank you for your reply.
It gives me this error
"Can't use aggregate functions inside of aggregate functions. "

Yeah I have APOC. But this leads me to the same error I have reported in the question:
"Type mismatch: expected Map, Node, Relationship, Point, Duration, Date, Time, LocalTime, LocalDateTime or DateTime but was List<Relationship"

Hello @AjejeBrazorf and welcome to the Neo4j community :slight_smile:

Sorry, new syntax, I always forget about it.

MATCH path=(a {id:"A"})<-[:HAS*]-(b)
RETURN a,b, max([r in relationships(path) | r.value])

Regards,
Cobra

1 Like

Thanks a lot. This perfectly works!
Thanks for your time.

Regards
Ajeje

1 Like