I want to check whether the max duration in each chain is the second node.
NA1 -> NA2 -> NA3 -> NA4
NB1 -> NB2 -> NB3 -> NB4
( N means node, A,b and the number are the attribute and each node has its own duration )
MATCH p = (A:Task{FROMLOCTYPE:"1"})-[:path*]->(b:Task{TOLOCTYPE:"4"})
WITH reduce(output = , n IN nodes(p) | output + n ) as tasks
But I'm stuck here and don't know how to check the maximum duration in each list.
Or do any operation in each list.
**and applied Query as **
unwind ["typeA","typeB","typeC"] as typeOf match p= (from:Chain)-[rel:CALLED{type:typeOf}]->(to:Chain) with rel.type as type, max(tointeger(rel.duration)) as maxDur return type, maxDur
I can group nodes according to the classification I want.
But I ’m not sure how to query for the max duration in each group with cypher.
MATCH p = (A:Task{FROMLOCTYPE:"LOAD_PORT"})-[:wafer_path*]->(b:Task{TOLOCTYPE:"LOAD_PORT"})
WITH reduce(output = , n IN nodes(p) | output + n ) as nodeCollection
Sorry my previous description was not clear enough.
Thank you again for your reply
Hi, thank for your apply again.
Yes I want to find the query dynamically.
I think my problem should be when I find a bunch of lists.
How do I search these nodes at the same time.
A bit like how to find the maximum value of an array in a two-dimensional array.
I want to find the max number in each list I find.
Sorry my previous description was not clear enough.
Thank you again for your reply
I am not very sure if below query is what you looking for
Dynamic type can be coded as below
match (from:Chain)-[rel:CALLED]->(to:Chain) with distinct rel.type as xyz unwind xyz as typeOf match p= (from:Chain)-[rel:CALLED{type:typeOf}]->(to:Chain) with rel.type as type, max(tointeger(rel.duration)) as maxDur return type, maxDur
If your requirement is different, then please frame your output and I will see if I am able to help you
This is helpful for me.
But if I don't want to use unwind ["typeA","typeB","typeC"] as typeOf.
How can I match the all type of the relation and unwind it?