Merge 2 different nodes and associate all the realtions to the single merged node

48 views
Skip to first unread message

Awi

unread,
Jun 19, 2014, 3:34:32 AM6/19/14
to ne...@googlegroups.com
In neo4j 2.0.3, can we merge 2 different nodes say node1 and node2, and all the relations associated with node1 and node2 will be then associate to the single merged node.

Thank-you

Michael Hunger

unread,
Jun 21, 2014, 11:05:19 AM6/21/14
to ne...@googlegroups.com
Unfortunately, you have to do it manually. Which API do you use?

Am 19.06.2014 um 09:34 schrieb Awi <awad...@ilminnovates.com>:

In neo4j 2.0.3, can we merge 2 different nodes say node1 and node2, and all the relations associated with node1 and node2 will be then associate to the single merged node.

Thank-you

--
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Awi

unread,
Jun 28, 2014, 8:10:17 AM6/28/14
to ne...@googlegroups.com

Ok ... Thank-you Michael ... We are using Java API.

Michael Hunger

unread,
Jun 28, 2014, 10:03:13 AM6/28/14
to ne...@googlegroups.com
It is some manual work,

find the two nodes

for the node with the fewer rels (b) to the node with more rels (a)
copy all properties from a to b
iterate over b's relationships and recreate them with a and the end node, copy each relationship's properties

Done.

Michael


Awadhesh Sharma

unread,
Jun 29, 2014, 11:41:12 PM6/29/14
to ne...@googlegroups.com
Yes Michael... we are taking the same approach... also we are taking care of duplicate relationships... Thank-you for your time


--
You received this message because you are subscribed to a topic in the Google Groups "Neo4j" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/neo4j/zmb_mln5NHc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to neo4j+un...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
 
          With Regards,

 

Description: cid:image001.png@01CC574A.FFA2D680

Awadhesh Kumar sharma

Software Engineer

ILM Innovative Solutions Pvt. Ltd.

+91-9766457911 (m)

awad...@ilminnovates.com

http://www.ilminnovates.com

Ranjan Sarangi

unread,
Sep 11, 2015, 11:52:29 AM9/11/15
to Neo4j, awad...@ilminnovates.com
Check this post for merger of nodes with relationships.

http://www.neo4j.org/graphgist?dropbox-14493611%2Fmerge_nodes.adoc 

This post has a nice explanation on how to merge nodes with its associated relationship.

Thanks
Ranjan 
Reply all
Reply to author
Forward
0 new messages