I have neo4j model which contains the country -> State--> District--> Tahasil, I want to reduce tahasil nodes to one single node by intacting relationships and properties to one which are belongs to same district, virtually

I have this graph model country -> State--> District--> Tahasil and I am using neo4j python driver along with apoc I want to reduce the tahasil nodes to one single node by intacting properties and relationships while reading to show case to end user like below

Country -> State-> District -> GroupTahasil,

I am trying to use below cypher query but its not working getting syntax error also its grouping all nodes.

MATCH p=(c:Country)-[:CONTAINS]-(s:State)-[:CONTAINS]-(d:District)-[:CONTAINS]-(t:Tahasil)
WITH apoc.nodes.collapse(nodes(p), {Label: "Type"}) AS groupedNodes
RETURN groupedNodes

which contains all tahasil nodes details, later I can allow user to explore more on this, what will be the best way to achieve this using cypher and apoc

Maybe this can help

apoc.nodes.collapse is a prodedure and hence you should use CALL....YIELD. Also check the syntax following the link provided by glilienfield