Reputation: 715
Given a graph with interconnected entities:
What is the most efficient way to aggregate common Vertices based on Edges. For instance - with the given graph - return Musicians with an aggregated band count.
My current approach is aggregating post selection:
select m, count(b) as cnt from (match {class:Musician, as: m}<-currentMember-{as:b} return m, b) group by m order by cnt desc limit 10
But this looks highly inefficient.
Upvotes: 0
Views: 73
Reputation: 2632
Try this:
select name, in('currentMember').size() as band from Musician order by band desc
Hope it helps
Regards
Upvotes: 2