So I have this network (screenshot above) of Research Publications. I am trying to visualize which Institutions (pink) are publishing together.
Each Publication (brown) has Author nodes (blue) connected by the AUTHORED relationship. Each Author has an AFFILIATED_WITH relationship to an Institution.
I am trying to visualize which Institutions share a common Publication together and have been really struggling with how to do this with Cypher
Match(p:Publication)-[:AUTHORED]->(a:Author)-[:AFFILIATED_WITH]->(i:Institution)
With p, collect(distinct i) as institutions
CALL apoc.nodes.link(institutions , 'SAME_PUB')
Return p
Hi! Thank you for the help, but the direction of the relationship between Author and Publication goes Author - AUTHORED -> Publication which is what I'm struggling with
Match(p:Publication)<-[:AUTHORED]-(a:Author)-[:AFFILIATED_WITH]->(i:Institution)
With p, collect(distinct i) as institutions
CALL apoc.nodes.link(institutions , 'SAME_PUB')
Return p
The WHERE will ensure that the query doesn't go back to the same publication if more that one author has worked on it.
As I said, this is off the top of my head. I haven't tried it out, so:
a) it may not work
b) it might take forever to run, depending on how much data you have