Skip to content

Commit

Permalink
IC 14 improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
yixinglu committed Dec 5, 2022
1 parent a0abc9c commit 72b2e72
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions nebula/queries/interactive-complex-14.ngql
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ WITH
[idx IN range(1, size(pathNodes)-1) | [prev IN [pathNodes[idx-1]] | [curr IN [pathNodes[idx]] | [prev, curr]]]] AS vertList
UNWIND vertList AS c
WITH c[0][0][0] AS prev, c[0][0][1] AS curr, personIdsInPath
OPTIONAL MATCH (curr)<-[e:COMMENT_HAS_CREATOR]-(:`Comment`)-[:REPLY_OF_POST]->(:Post)-[:POST_HAS_CREATOR]->(prev)
WITH count(e) AS cnt1, prev, curr, personIdsInPath
OPTIONAL MATCH (prev)<-[e:COMMENT_HAS_CREATOR]-(:`Comment`)-[:REPLY_OF_POST]->(:Post)-[:POST_HAS_CREATOR]->(curr)
WITH count(e) AS cnt2, cnt1, prev, curr, personIdsInPath
OPTIONAL MATCH (prev)<-[e:COMMENT_HAS_CREATOR]-(:`Comment`)-[:REPLY_OF_COMMENT]->(:`Comment`)-[:COMMENT_HAS_CREATOR]->(curr)
WITH count(e) AS cnt3, cnt1, cnt2, prev, curr, personIdsInPath
OPTIONAL MATCH (curr)<-[e:COMMENT_HAS_CREATOR]-(:`Comment`)-[:REPLY_OF_COMMENT]->(:`Comment`)-[:COMMENT_HAS_CREATOR]->(prev)
WITH count(e) AS cnt4, cnt1, cnt2, cnt3, prev, curr, personIdsInPath
OPTIONAL MATCH (curr)<-[:COMMENT_HAS_CREATOR]-(comm:`Comment`), (prev)<-[:POST_HAS_CREATOR]-(:Post)<-[:REPLY_OF_POST]-(comm)
WITH count(comm) AS cnt1, prev, curr, personIdsInPath
OPTIONAL MATCH (prev)<-[:COMMENT_HAS_CREATOR]-(comm:`Comment`), (curr)<-[:POST_HAS_CREATOR]-(:Post)<-[:REPLY_OF_POST]-(comm)
WITH count(comm) AS cnt2, cnt1, prev, curr, personIdsInPath
OPTIONAL MATCH (prev)<-[:COMMENT_HAS_CREATOR]-(comm:`Comment`)-[:REPLY_OF_COMMENT]->(comm2:`Comment`), (curr)<-[:COMMENT_HAS_CREATOR]-(comm2)
WITH count(comm) AS cnt3, cnt1, cnt2, prev, curr, personIdsInPath
OPTIONAL MATCH (curr)<-[:COMMENT_HAS_CREATOR]-(comm:`Comment`)-[:REPLY_OF_COMMENT]->(comm2:`Comment`), (prev)<-[:COMMENT_HAS_CREATOR]-(comm2)
WITH count(comm) AS cnt4, cnt1, cnt2, cnt3, prev, curr, personIdsInPath
RETURN personIdsInPath, sum(cnt1 + cnt2 + 0.5 * cnt3 + 0.5 * cnt4) AS pathWeight
ORDER BY pathWeight DESC, personIdsInPath DESC

0 comments on commit 72b2e72

Please sign in to comment.