Say I have multiple tree:
A<-{D, E}<-F
B<-{E, G}
C<-{E, H}
//Where only A, B, and C are of (:parent{name:""})
//There rest is child
Given a set of children nodes:
{E, F} //(:child{name:""})
//Clearly A is the most connected parent even if F is not directly connected to A
Question: How can I find the most connected parent node given the children nodes collection? Any cypher query, plugin function or procedure is welcomed. HELP.
Here's what I have tried but with no luck because it count the total relationship between two nodes:
MATCH (c:child)--(p:parent)
WHERE c.name IN ['E', 'F']
RETURN p ORDER BY size( (p)--(c) ) DESC LIMIT 1
//Also tried size( (p)--() ) but it count all relationship that the parent node has.