TrustRank: seed-biased PageRank in pagerankr

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(pagerankr)

What TrustRank is

TrustRank (Gyöngyi, Garcia-Molina & Pedersen, 2004) is ordinary PageRank with one change: instead of the random surfer teleporting to a uniform random page, it teleports back into a set of trusted seed pages. Trust then propagates outward along links and attenuates with distance — the further a page is from the trusted core, the less trust reaches it. The PageRank damping factor is exactly that attenuation mechanism, so no extra machinery is needed.

The original motivation was web spam: pick a small set of human-vetted "good" pages, and let trust flow from them so that link farms — which good pages rarely link to — stay low. The same mechanic is useful on a single site for any "authority radiates from these known-good pages" question: your editorial hubs, your hand-picked cornerstone content, or a manually curated quality set.

This is seed-biased PageRank, not a spam classifier. pagerankr supplies the biased-propagation core; which pages are trustworthy is your call.

It reuses the personalization path — no new solver

A trusted-seed set is just a teleport (personalization) prior. pagerankr already builds personalized PageRank from a per-URL prior via pagerank(prior_df = ...) (the TIPR path). TrustRank is therefore two small helpers over that engine:

A worked example

edges <- data.frame(
  from = c("/", "/", "/hub", "/hub", "/good", "/spam", "/spam"),
  to = c("/hub", "/good", "/good", "/deep", "/hub", "/sink", "/good")
)

Here / and /hub are our trusted editorial core. /spam links into the good neighborhood (a classic spam tactic) but nothing trusted links to it, and it feeds an off-topic /sink.

Build the seed prior explicitly

prior <- seed_prior(c("/", "/hub"))
prior

Equal weights reproduce TrustRank's uniform distribution over the trusted set. Run it through pagerank() like any other prior:

pr_manual <- pagerank(edges, prior_df = prior, clean_edge_urls = FALSE)
pr_manual[order(-pr_manual$pagerank), c("node_name", "pagerank")]

Or use the convenience wrapper

tr <- trustrank(edges, c("/", "/hub"), clean_edge_urls = FALSE)
tr[order(-tr$pagerank), c("node_name", "pagerank", "prior_weight")]

trustrank() is identical to the manual call — it just builds the prior for you. Two things to read in the output:

Compare against uniform PageRank

uni <- pagerank(edges, clean_edge_urls = FALSE)
compare_pagerank(uni, tr)[, c("node_name", "pagerank_a", "pagerank_b", "delta")]

pagerank_a is uniform PageRank, pagerank_b is TrustRank. The trusted core and what it links to gain; the untrusted region loses.

Graded trust and a teleport floor

Trust need not be all-or-nothing. Give some seeds more weight than others:

trustrank(
  edges,
  data.frame(url = c("/", "/hub"), weight = c(3, 1)),
  clean_edge_urls = FALSE
)[, c("node_name", "pagerank", "prior_weight")]

By default untrusted, seed-unreachable pages receive no teleport mass at all. To give every page a small floor (a blend of trust teleport and uniform teleport), pass prior_alpha:

trustrank(
  edges, c("/", "/hub"),
  prior_alpha = 0.15, clean_edge_urls = FALSE
)[, c("node_name", "pagerank", "prior_weight")]

prior_alpha = 0 (the default) is pure trust teleport; prior_alpha = 1 reproduces uniform PageRank.

Notes



Try the pagerankr package in your browser

Any scripts or data that you put into this service are public.

pagerankr documentation built on Oct. 1, 2026, 5:09 p.m.