Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IC 14 improvement #67

Merged
merged 1 commit into from
Dec 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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