How to connect real nodes to virtual nodes created through apoc.nodes.group?

Hello there,

I am a beginner and trying to do the following, but not managing and wondering if it even is possible at all:

I have a graph and want to group the nodes in categories and show the aggregated nodes/relations. This works flawlessly and exactly how i want with apoc.nodes.group .
The next step is, that I would like to expand one of the virtual nodes to show all real nodes that are included in it, and also show the real relationships they have with the nodes inside the other virtual nodes.

Through grouping all nodes except for one category, and unioning this with all nodes from that category, I almost achieve what I want. I get the virtual nodes and rels, I get the real nodes and rels from the specific category, but the thing missing is the "mixed" rels that go from the real nodes to the virtual nodes.

So, my question is: Is there any way to let real relationships be "redirected" to their corresponding virtual group node?

Maybe someone with more experience can point me in the right direction or confirm my fear that this is not easily possible with Cypher/APOC. Thank you for reading!

Hi Joey,
There is apoc.nodes.collapse which could help you as it keeps the original node's id so that e.g. browser can expand from that node again.

Please try and let us know if it worked.