cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

What is a good way to show relationship between a subgroup?

Hi, newbie here and seriously don't know how to title this query, so pardon me on that.

We have a product hierarchy which I want to explore in Neo4j as there are lot of intricate relations that are not brought out in RDBMS. While there is top down hierarchical flow, there are lot of relationships between various nodes at same & different level. For ex, I found something like this, where there is a subgroup that are closely related within a larger group.

2X_6_66aa07d45a8529f3f6a01a70c93d902c4625446e.png

My question is how to group these in a way to show relationship? As of now, there are ~10 nodes in this sub group. Do I run a relation between every 2 in the 10 nodes, so 10C2 = 45 relations? Or is there a another way to show these relationship? Running 45 relationships for 10 nodes seems a over kill.

3 REPLIES 3

One option would be to create nodes that represent the subgroups. Then link the various nodes to that subgroup node. How appropriate this solution is depends on what the subgroups represent. If the subgroups represent an alternative category or classification this would be good.

The previous answer is a good suggestion, but just on this point -

Having many more relationships than nodes is a feature of a lot of graphs that I've seen, and doesn't indicate any kind of technical or design problem. It can become a problem if you end up with hypernodes that have huge numbers of relationships attached, but the numbers you mention are nowhere near that level.

nghia71
Node Clone

Depending on how many are those for each group:
1/ An intermediate node to 'own' the group is good idea, but costly in traversal or more verbose Cypher
2/ Directly linking them would be better, but too many relationships unnecessarily (I think)
3/ Using an indexed property or a label might help, but of course you need to keep track on that.