Skip to contents

1 pagerankr pagerankr hex sticker

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:

  • End-to-end and low-level PageRank calculation
  • Redirect diagnostics and resolution policies
  • Nofollow and indexability-aware PageRank modeling
  • Domain/host filtering and edge-weight transformations
  • Screaming Frog Internal: All plus All Inlinks/Outlinks import adapters
  • Model comparison, parameter sweeps, and what-if simulations
  • Graph export utilities and an optional interactive Shiny explorer
  • HITS hub and authority scores (hits())
  • SALSA hub and authority scores (salsa())
  • TrustRank seed-biased PageRank (trustrank())
  • Topic-Sensitive PageRank (per-topic authority with blended scores)
  • Reverse-graph feeder PageRank (find pages that power a cluster)
  • GA4 behavioral transition modeling (transition counts, structural smoothing, entrance teleport)
  • PageRank convergence controls (algo/eps/niter) and alpha-stability reporting (pagerank_stability())

1.1 Installation

# install.packages("devtools")
devtools::install_github("bart-turczynski/pagerankr")

1.2 Quick Start

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)

1.3 Current Capabilities

1.3.1 Crawl Data Prep and Redirect QA

audit <- audit_redirects(redirects, edge_list_df = edges)
print(audit)

resolve_urls(
  c("http://example.com/old-blog", "http://example.com/home"),
  redirects
)

1.3.2 Screaming Frog Crawl Imports

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)
)

1.3.3 PageRank Modeling Controls

  • pagerank() supports weighted edges via weight_col
  • duplicate_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 = "trap" or "vanish")
  • Domain scoping directly in pagerank() (keep_domains, exclude_domains) or via filter_links_by_domain() with domain/host keep/ignore rules
  • transform_weights() provides rank/log/zipf/percentile transforms for raw edge signals
edges_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)

1.3.4 Comparison, Grid Search, and Simulation

grid <- 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)

1.3.5 Export and Exploration

pr <- 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()

1.4 Key Functions

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_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
trust_seed_prior() Build a teleport prior for trustrank()
topic_sensitive_pagerank() Per-topic personalized PageRank with blended scores
topic_feeder_pagerank() Reverse-graph seeded PR: find pages that feed a cluster
feeder_seed_prior() Build a teleport prior for 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

1.5 Further Information

The package website contains the complete reference and rendered vignettes. To report a bug or request an enhancement, use GitHub 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")

1.6 Code of Conduct

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.

1.7 License

MIT License. See the LICENSE file for details.