Hi all,
I just tried plenty of queries and it either doesn't show me results I want or it throws timeout, I think it is set to 1 hour.
I'm trying to answer the following question: which are the 20 nodes with highest degree and the 200 nodes with highest degree connected to them?
The details are that they have User label and the relationship direction has to be ("200 nodes":User)-[:wrote]->("20 nodes":User)
The network has more than 400k nodes (users is 200k) and more than 3M relationships (2M rel. authorship)
Neo4j version: 4.1.3 community
What I tried:
- Timeout after 1 hour
MATCH (n:User)
WHERE SIZE((n)-[:AUTHORSHIP]-()) > 10
CALL {
MATCH(p:User)
RETURN p ORDER BY SIZE((p)<-[:AUTHORSHIP]-()) DESC LIMIT 20
UNION
MATCH(p:User)
RETURN p ORDER BY SIZE((p)-[:AUTHORSHIP]->()) DESC LIMIT 200
}
RETURN p
- Wrong output
MATCH (n:User)<-[:AUTHORSHIP]-()
WITH n ORDER BY SIZE((n)<-[:AUTHORSHIP]-()) DESC LIMIT 20
CALL {
WITH n
MATCH (m)-[r:WROTE]->(n)
RETURN m ORDER BY SIZE((m)-[:AUTHORSHIP]->()) DESC LIMIT 200
}
RETURN n,m
Relationship sample
MATCH (n:User)-[r:WROTE]->(m:User)
RETURN n.name, m.name, RAND() as r ORDER BY r LIMIT 1000
sample.txt (27.6 KB)