January 2018
Intermediate to advanced
332 pages
7h 36m
English
Now, let's move over to creating our Personalized PageRank (PPR) algorithm. We will be creating an ES6 class, which will handle all of the logic to generate the suggestions once we provide the graph and target node to it. Note that in the preceding code, I have already shown you what the graph looks like:
const users = { A: { neighbors: [ 'B', 'D' ] }, B: { neighbors: [ 'A', 'C', 'E' ] }, C: { neighbors: [ 'B', 'D', 'E' ] }, D: { neighbors: [ 'A', 'C' ] }, E: { neighbors: [ 'B', 'C' ] }};
We have established a bidirectional relationship by specifying two nodes as each other's neighbors. Now, we can start with the code for PPR:
const _ = require('lodash');class PPR { constructor(data) { this.data = data; ...
Read now
Unlock full access