I have a chart that will represent hierarchy for nodes like this one.
Lets say that this one is representing the complete hierarchy but I also need to create intermediate result by grouping at different levels.
Suppose I'm requesting data for node A. I wish to regroup nodes at the nearest Group relationship. I'd to get something like this:
Basically users will be allowed to associate nodes to group and I need to represent the data in the convenient way to display an Org Chart.
I don't know where to start to get the optimal solution.
Here's my neo4js db:
CREATE (a:Node { name: 'a' }), (b:Node { name: 'b' }),
(c:Node { name: 'c' }), (d:Node { name: 'd' }),
(e:Node { name: 'e' }), (f:Node { name: 'f' }),
(g:Node { name: 'g' }), (h:Node { name: 'h' }),
(g1:Group { name: 'group1'}),
(g2:Group { name: 'group2'}),
(g3:Group { name: 'group3'}),
(a)-[:child]->(b),
(a)-[:child]->(c),
(a)-[:child]->(d),
(b)-[:child]->(e),
(c)-[:child]->(f),
(c)-[:child]->(g),
(c)-[:child]->(h),
(b)-[:belongsTo]->(g1),
(c)-[:belongsTo]->(g2),
(g)-[:belongsTo]->(g3),
(h)-[:belongsTo]->(g3);
If you want to see how many organizations are contained in any given group, this is straightforward:
That will give you each group name, along with how many nodes are in it.