Displaying pagerank is quite complex, since most end users don't know what it is and how it's defined.
Furthermore, Pagerank follows a power-law, which is inherently hard for humans to understand.
An easier way to understand the pagerank p of an entity is to display the % of the network it is part of.
Something like "entity is part of the top 1%". However sometimes we wish to display the pagerank as a 0-100 score.
The linear mapping
Considering the power law model with exponent b and a graph of N nodes, the highest j-th node by pagerank has
by inverting the formula one get the position of a node with pagerank p
and the % of the network with pagerank lower than p is simply
To remove the singularity in 0 we add to the denominator
This way
This is close, but the values are too skewed towards the high scores.
We can lower the exponent to something like
// Score returns a "natural" score from 0-100 given the following inputs:
// - pagerank: the pagerank of the entity
// - nodes: the number of nodes in the graph
export const Score = (pagerank, nodes) => {
const b = 0.76
const a = 0.38 // curvature control
const C = 1 - b // base constant
const denom = nodes * pagerank + C
const value = 1 - (C / denom) ** a
return 100 * value
}