Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
10-09-2020 06:01 AM
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.
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.
10-09-2020 01:06 PM
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.
10-09-2020 05:50 PM
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.
10-10-2020 11:35 AM
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.
All the sessions of the conference are now available online