use of apoc.algo.pagerank.PageRankArrayStorageParallelSPI in project neo4j-apoc-procedures by neo4j-contrib.
the class PageRank method innerPageRank.
private Stream<NodeScore> innerPageRank(Long iterations, List<Node> nodes, RelationshipType... types) {
try {
PageRankArrayStorageParallelSPI pageRank = new PageRankArrayStorageParallelSPI(db, guard, pool);
pageRank.compute(iterations.intValue(), types);
return nodes.stream().map(node -> new NodeScore(node, pageRank.getResult(node.getId())));
} catch (Exception e) {
String errMsg = "Error encountered while calculating page rank";
log.error(errMsg, e);
throw new RuntimeException(errMsg, e);
}
}
use of apoc.algo.pagerank.PageRankArrayStorageParallelSPI in project neo4j-apoc-procedures by neo4j-contrib.
the class PageRank method innerPageRankStats.
private Stream<PageRankStatistics> innerPageRankStats(int iterations, Map<String, Object> config, RelationshipType... types) {
try {
PageRankArrayStorageParallelSPI pageRank = new PageRankArrayStorageParallelSPI(db, guard, pool);
pageRank.compute(iterations, types);
if ((boolean) config.getOrDefault(SETTING_WRITE, DEFAULT_PAGE_RANK_WRITE)) {
pageRank.writeResultsToDB();
}
return Stream.of(pageRank.getStatistics());
} catch (Exception e) {
String errMsg = "Error encountered while calculating page rank";
log.error(errMsg, e);
throw new RuntimeException(errMsg, e);
}
}
Aggregations