Skip to content
This repository was archived by the owner on Apr 22, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion doc/pagerank.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ For now there is no option to load the the relationship as undirected, but we ca
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.

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

.Running algorithm on Yelp social network
Expand Down
14 changes: 13 additions & 1 deletion doc/scripts/pagerank.cypher
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,16 @@ CALL algo.pageRank(
'MATCH (p1:Page)-[:Link]->(p2:Page) RETURN id(p1) as source, id(p2) as target',
{graph:'cypher', iterations:5, write: true});

// end::cypher-loading[]
// end::cypher-loading[]

// tag::pagerank-stream-yelp-social[]

call algo.pageRank.stream(
'MATCH (u:User) WHERE exists( (u)-[:FRIENDS]-() ) RETURN id(u) as id',
'MATCH (u1:User)-[:FRIENDS]-(u2:User) RETURN id(u1) as source, id(u2) as target',
{graph:'cypher'}
) yield node,score with node,score order by score desc limit 10
return node {.name, .review_count, .average_stars,.useful,.yelping_since,.funny},score;

// end::pagerank-stream-yelp-social[]

13 changes: 0 additions & 13 deletions doc/scripts/yelp-import.cypher
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,3 @@ ON CREATE SET cr.weight = weight
',{batchSize: 1});

// end::coocurence-graph[]

// tag:pagerank-stream-yelp-social[]

call algo.pageRank.stream(
'MATCH (u:User) WHERE exists( (u)-[:FRIENDS]-() ) RETURN id(u) as id',
'MATCH (u1:User)-[:FRIENDS]->(u2:User) RETURN id(u1) as source, id(u2) as target
UNION
MATCH (u1:User)-[:FRIENDS]->(u2:User) RETURN id(u2) as source, id(u1) as target',
{graph:'cypher'}
) yield node,score with node,score order by score desc limit 10
return node {.name, .review_count, .average_stars,.useful,.yelping_since,.funny},score;

// end:pagerank-stream-yelp-social[]