1
votes

one of my questions was already answered:

Neo4j: Display all connected nodes and their parent in tree-like graph

The final query was :

query = CypherQuery(graph, "MATCH path=(n {name:{node}})<-[:DEPENDS_ON*]-() WITH NODES(path) AS np WITH REDUCE(s=[], i IN RANGE(0, LENGTH(np)-2, 1) | s + {p:np[i], c:np[i+1]}) AS cpairs UNWIND cpairs AS pairs WITH DISTINCT pairs AS ps RETURN ps.p, ps.c")

I need to be able to RETURN a label for each ps.p and ps.c in the same query. I've tried few things withot success. Please advise.

Thanks.

Peter

1

1 Answers

1
votes

Have you tried to just amend , labels(ps.p), labels(ps.c) at the end (aka in RETURN)?