Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
12-28-2020 06:26 AM
Hi everyone ! I have to write a query about collaboration between authors for my homework. My nodes are "authors" and "articles". I have connected articles and authors as ( ()-[:composedby]->()) and authors between them the same way. I want to write a query so to find the top 5 authors with most distinct collaborations but this one didn't work :
</>
MATCH (a:Author)-[:WORKSWITH]->(b:Author) MATCH (article:Article)-[:COMPOSEDBY]->(a:Author) RETURN a.name AS Name, COUNT(b) AS Collaboration ORDER BY Collaboration DESC LIMIT 5
</>
Any ideas with that ? I wrote COUNT( DISTINCT b) but still no result.
12-28-2020 11:42 AM
Try this:
MATCH (article:Article)-[:COMPOSEDBY]->(a:Author)
MATCH (a)-[:WORKSWITH]->(b.Author)
RETURN a.name AS Name, COUNT(distinct b.name) AS Collaboration
ORDER BY Collaboration DESC LIMIT 5
All the sessions of the conference are now available online