I have several graphs in the Neo4j database.
CREATE (home:neo4jPageRank1 {name:"Home"}), (about:neo4jPageRank1 {name:"About"}), ...
CREATE (home:neo4jPageRank2 {name:"Home"}), (about:neo4jPageRank2 {name:"About"}), ...
CREATE (home:neo4jPageRank3 {name:"Home"}), (about:neo4jPageRank3 {name:"About"}), ...
I will run the PageRank algorithm on the neo4jPageRank1
named graph.
I can do this:
CALL algo.pageRank.stream("neo4jPageRank1", null, {iterations:20})
YIELD nodeId, score
MATCH (node) WHERE id(node) = nodeId
RETURN node.name AS page,score
ORDER BY score DESC
or do:
CALL algo.graph.load('my-graph', 'neo4jPageRank1', null, {graph: 'huge'})
CALL algo.pageRank.stream(null, null, {graph:"my-graph", iterations:20})
YIELD nodeId, score
MATCH (node) WHERE id(node) = nodeId
RETURN node.name AS page,score
ORDER BY score DESC
what is the most efficient solution?
In my opinion
- the second solution being executed in memory is more powerful.
- If the memory is restricted the first solution is to be preferred.