How to return nodes that have a relationship as a group along with path length

Hello. Any chance for this one please?

See if this meets your needs.

MATCH path = (l:Partner)-[:HAS_MT4]->(n:Mt4)-[:HAS_REF*]->(:Mt4)<-[:HAS_MT4]-(m:Partner)
WITH m, reverse(nodes(path)) as nodes
UNWIND range(1, size(nodes)-1) as level
WITH m, level, collect(id(nodes[level])) as nodesByLevel
return m.partner_id as parent, {level: level, nodes: nodesByLevel}

Thank you for your reply. It is not exactly what I need. If we have a less complex example like this one, maybe it is much easier for you to explain

john <- BROUGHT_BY Bill <- BROUGHT_BY Nick <- BROUGHT_BY Anna <- BROUGHT_BY Michael
john <- BROUGHT_BY Bill <- BROUGHT_BY Nick <- BROUGHT_BY Anna <- BROUGHT_BY Peter

how would you end up with something like this when searching for john, and John was not brought by anyone else?

[Bill:1,Nick:2,Anna:3,Michael:4]
[Bill:1,Nick:2,Anna:3,Peter:4]

So, get the full path, in this case two different paths

That is what the query returned, but I had merge the results from both paths internet one since both paths originated from the same patner_id.

What changes do your need. Have it output separate results from each list?

Oops, now I realized I intended to perform a collect to get one row for each partner_id, so the above result would be one row instead of four. Would that help?