
pagerankr is an SEO-focused R toolkit for PageRank
modeling on crawl data. It supports both a single end-to-end wrapper
(pagerank()) and modular building blocks for cleaning URLs,
auditing redirects, resolving link graphs, running scenario comparisons,
and exporting graph outputs.
The package currently includes:
hits())salsa())trustrank())pagerank_stability())# install.packages("devtools")
devtools::install_gitlab("bart-turczynski/pagerankr")library(pagerankr)
edges <- data.frame(
from = c("http://example.com/home",
"http://example.com/about",
"http://example.com/blog"),
to = c("http://example.com/about",
"http://example.com/home",
"http://example.com/home")
)
redirects <- data.frame(
from = "http://example.com/old-blog",
to = "http://example.com/blog"
)
pr <- pagerank(edges, redirects_df = redirects)
print(pr)clean_url_columns() canonicalizes URL columns using
rurl::get_clean_urlaudit_redirects() reports redirect chains, loops,
conflicts, self-refs, and optional orphaned rules vs. an edge listresolve_redirects() applies redirect maps to an edge
list with conflict and loop policiesresolve_redirect_urls() resolves a character vector of
URLs without requiring an edge listresolve_links() returns the resolved/deduplicated graph
without computing PRget_unique_edges() and drop_isolates()
provide explicit graph hygiene toolsaudit <- audit_redirects(redirects, edge_list_df = edges)
print(audit)
resolve_redirect_urls(
c("http://example.com/old-blog", "http://example.com/home"),
redirects
)Use screaming_frog_bundle() with an Internal:
All export and either All Inlinks or
All Outlinks. The node export supplies page facts,
redirects, canonicals, and indexability. The link export supplies raw
link observations and graph-eligible Hyperlink edges. Resource,
canonical, hreflang, and other non-Hyperlink link rows are retained in
diagnostics but excluded from the PageRank graph by default.
bundle <- screaming_frog_bundle(
internal = "internal_all.csv",
links = "all_outlinks.csv",
link_export_kind = "all_outlinks"
)
pr <- pagerank_screaming_frog(bundle)
attr(pr, "screaming_frog_import")
attr(pr, "transition_audit")Placement and rendered-vs-HTML policies are explicit scoring choices:
pagerank_screaming_frog(
bundle,
accepted_placements = c("nav", "content"),
link_origins = c("html", "html_rendered"),
placement_weights = c(nav = 2, content = 1)
)pagerank() supports weighted edges via
weight_colduplicate_edge_policy = "collapse" keeps the standard
binary destination-level surfer as the default: repeated
from -> to rows become one edge. Opt into
"aggregate" to sum duplicate numeric weights, or
"count_instances" for a link-slot surfer where repeated
links to the same target increase transition probability.nofollow_col +
nofollow_action = c("evaporate", "drop", "keep")indexability_df support for noindex and
Blocked by robots.txt behaviors
(robots_blocked_action = "show" or
"vanish")pagerank()
(keep_domains, exclude_domains) or via
filter_links_by_domain() with domain/host keep/ignore
rulestransform_weights() provides rank/log/zipf/percentile
transforms for raw edge signalsedges_w <- data.frame(
from = c("Home", "Home", "Home"),
to = c("About", "Blog", "Contact"),
position = c(1, 2, 5)
)
edges_w$weight <- transform_weights(
edges_w$position,
method = "zipf",
descending = FALSE
)
pagerank(edges_w, weight_col = "weight", clean_edge_urls = FALSE)compare_pagerank() calculates deltas, rank shifts, and
summary statsauto_grid() and pagerank_grid() run
parameter sweepsanalyze_pagerank_grid() summarizes
concentration/distribution effectssimulate_changes() compares baseline vs proposed
links/redirectspr_gini(), pr_entropy(), and
pr_top_k_share() compute distribution metricsgrid <- auto_grid(
damping = c(0.85, 0.95),
nofollow_action = c("evaporate", "drop")
)
grid_results <- pagerank_grid(edges, params_grid = grid, clean_edge_urls = FALSE)
analyze_pagerank_grid(grid_results)export_graph() writes outputs in graphml,
dot, edgelist, or pajek
formatslaunch_pagerank_explorer() launches an interactive
Shiny app for uploads, visualization, redirect auditing, and
exportspr <- pagerank(edges, clean_edge_urls = FALSE)
export_graph(pr, edges, file = "pagerank.graphml", format = "graphml")
# Optional interactive app:
# install.packages(c("shiny", "DT", "visNetwork"))
# launch_pagerank_explorer()| Function | Purpose |
|---|---|
pagerank() |
End-to-end PageRank pipeline |
compute_pagerank() |
Low-level wrapper around
igraph::page_rank() |
resolve_links() |
Resolve redirects and deduplicate graph without PR |
resolve_redirects() |
Apply redirect rules to an edge list |
resolve_redirect_urls() |
Resolve standalone URL vectors through redirects |
resolve_canonicals() |
Apply rel=canonical folds to edge endpoints |
resolve_folded_urls() |
Resolve URL vectors through redirects plus canonicals |
audit_redirects() |
Diagnose redirect chains, loops, and conflicts |
screaming_frog_bundle() |
Compose Screaming Frog node and link exports |
pagerank_screaming_frog() |
Score a Screaming Frog bundle via
pagerank() |
clean_url_columns() |
Canonicalize URL columns in data frames |
get_unique_edges() |
Deduplicate edges and handle self-loops |
drop_isolates() |
Build vertex sets with or without isolates |
filter_links_by_domain() |
Filter edges by keep/ignore domain or host lists |
transform_weights() |
Transform raw signals into PageRank edge weights |
compare_pagerank() |
Compare two PageRank outputs with rank deltas |
simulate_changes() |
Evaluate proposed link/redirect changes |
auto_grid() |
Build exhaustive parameter grids |
pagerank_grid() |
Run PageRank across multiple parameter sets |
analyze_pagerank_grid() |
Summarise PageRank distribution by model |
pr_gini() |
Gini concentration metric |
pr_entropy() |
Entropy dispersion metric |
pr_top_k_share() |
Top-k PageRank concentration share |
export_graph() |
Export graph and PageRank metadata for external tools |
launch_pagerank_explorer() |
Start the interactive Shiny explorer |
hits() |
End-to-end HITS hub + authority scores |
compute_hits() |
Low-level igraph HITS wrapper |
salsa() |
End-to-end SALSA hub + authority scores |
compute_salsa() |
Low-level SALSA computational core |
trustrank() |
TrustRank: seed-biased PageRank from a trusted seed set |
topic_sensitive_pagerank() |
Per-topic personalized PageRank with blended scores |
topic_feeder_pagerank() |
Reverse-graph seeded PR: find pages that feed a cluster |
seed_prior() |
Build a teleport prior from a seed set (for trustrank / topic_feeder_pagerank) |
align_prior_to_vertices() |
Align a prior/teleport data frame to the graph vertex set |
damping_sensitivity() |
Sweep PageRank across a range of damping factors |
pagerank_stability() |
Alpha-stability report: rank correlation across a damping grid |
ga4_page_transitions() |
Consecutive page-view transition counts from a GA4 export |
smooth_transitions() |
Shrink sparse empirical transitions toward a structural prior |
ga4_entrance_teleport() |
Entrance/landing-page counts as a PageRank teleport vector |
aggregate_edges() |
Aggregate duplicate edges after URL folding |
transform_edge_weights() |
Per-source grouped edge weight transforms |
validate_edge_weights() |
Validate per-source weight totals |
screaming_frog_internal() |
Import Screaming Frog Internal: All export |
screaming_frog_links() |
Import Screaming Frog All Inlinks / All Outlinks export |
audit_redirects() |
Diagnose redirect chains, loops, and conflicts |
audit_canonicals() |
Diagnose rel=canonical fold coverage and conflicts |
resolve_canonicals() |
Apply rel=canonical folds to an edge list |
resolve_canonical_urls() |
Resolve a URL vector through rel=canonical folds |
resolve_folded_urls() |
Resolve a URL vector through redirects plus canonicals |
The reference and vignettes ship with the package and are reachable
through help(package = "pagerankr") and the
vignette() calls below; the rendered website is being
rebuilt after the move to GitLab. To report a bug or request an
enhancement, use GitLab
Issues. Please read CONTRIBUTING.md
before proposing a change; it sets out the test, lint, and R CMD check
requirements. For privately reported security vulnerabilities, follow SECURITY.md.
help(package = "pagerankr")
vignette("pagerankr-usage")
vignette("trustrank")
vignette("topic_feeder_pagerank")Please note that the pagerankr project is released with
a Contributor
Code of Conduct. By contributing to this project, you agree to abide
by its terms.
MIT License. See the LICENSE file for details.