All Projects → alixaxel → pagerank.js

alixaxel / pagerank.js

Licence: MIT license
Vanilla JavaScript implementation of the Weighted PageRank Algorithm

Programming Languages

javascript
184084 projects - #8 most used programming language

pagerank.js

NPM Version NPM Downloads

Vanilla JavaScript implementation of the Weighted PageRank Algorithm

Usage

var graph = require('pagerank.js');

graph.link(1, 2, 1.0);
graph.link(1, 3, 2.0);
graph.link(2, 3, 3.0);
graph.link(2, 4, 4.0);
graph.link(3, 1, 5.0);

graph.rank(0.85, 0.000001, function (node, rank) {
    console.log("Node " + node + " has a rank of " + rank);
});

Output

Node 1 has a rank of 0.34983779905464363
Node 2 has a rank of 0.1688733284604475
Node 3 has a rank of 0.3295121849483849
Node 4 has a rank of 0.15177668753652385

Install

npm install pagerank.js --save

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].