Skip to content
This repository was archived by the owner on Apr 22, 2020. It is now read-only.

Commit 0f4b15b

Browse files
tomasonjojexp
authored andcommitted
Fix pagerank yelp query (#431)
1 parent c7a0c54 commit 0f4b15b

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

doc/pagerank.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ For now there is no option to load the the relationship as undirected, but we ca
115115
Undirected graph can be represented as https://en.wikipedia.org/wiki/Bidirected_graph[Bidirected graph], that is a directed graph in which the reverse of every relationship is also a relationship.
116116

117117
We do not have to save this reversed relationship, we can project it using *cypher loading*.
118-
We load all relationships and then use `UNION` to also load all relationships with reversed directions.
118+
Note that relationship query does not specify direction of the relationship.
119119
This is applicable to all other algorithms, that use *cypher loading*.
120120

121121
.Running algorithm on Yelp social network

doc/scripts/pagerank.cypher

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,16 @@ CALL algo.pageRank(
4444
'MATCH (p1:Page)-[:Link]->(p2:Page) RETURN id(p1) as source, id(p2) as target',
4545
{graph:'cypher', iterations:5, write: true});
4646

47-
// end::cypher-loading[]
47+
// end::cypher-loading[]
48+
49+
// tag::pagerank-stream-yelp-social[]
50+
51+
call algo.pageRank.stream(
52+
'MATCH (u:User) WHERE exists( (u)-[:FRIENDS]-() ) RETURN id(u) as id',
53+
'MATCH (u1:User)-[:FRIENDS]-(u2:User) RETURN id(u1) as source, id(u2) as target',
54+
{graph:'cypher'}
55+
) yield node,score with node,score order by score desc limit 10
56+
return node {.name, .review_count, .average_stars,.useful,.yelping_since,.funny},score;
57+
58+
// end::pagerank-stream-yelp-social[]
59+

doc/scripts/yelp-import.cypher

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,3 @@ ON CREATE SET cr.weight = weight
103103
',{batchSize: 1});
104104

105105
// end::coocurence-graph[]
106-
107-
// tag:pagerank-stream-yelp-social[]
108-
109-
call algo.pageRank.stream(
110-
'MATCH (u:User) WHERE exists( (u)-[:FRIENDS]-() ) RETURN id(u) as id',
111-
'MATCH (u1:User)-[:FRIENDS]->(u2:User) RETURN id(u1) as source, id(u2) as target
112-
UNION
113-
MATCH (u1:User)-[:FRIENDS]->(u2:User) RETURN id(u2) as source, id(u1) as target',
114-
{graph:'cypher'}
115-
) yield node,score with node,score order by score desc limit 10
116-
return node {.name, .review_count, .average_stars,.useful,.yelping_since,.funny},score;
117-
118-
// end:pagerank-stream-yelp-social[]

0 commit comments

Comments
 (0)