View source: R/pagerank_stability.R
| pagerank_stability | R Documentation |
Sweeps [pagerank()] over a grid of damping factors with
[damping_sensitivity()] and compares each \alpha's ranking against a
reference \alpha with [compare_pagerank()], returning a one-row-per-
\alpha stability summary. It answers the open question flagged in the
"Damping factor" section of [pagerank()]: on *your* graph, how much does
the ranking actually move as \alpha varies?
pagerank_stability(
edge_list_df,
alphas = c(0.75, 0.8, 0.85, 0.9, 0.95),
reference = 0.85,
top_k = 10,
...
)
edge_list_df |
A data frame representing the edge list, passed to every [pagerank()] call. (Named for consistency with the rest of the package; it is an edge list, not a constructed graph object.) |
alphas |
Numeric vector of damping factors to sweep, each strictly between 0 and 1. Default 'c(0.75, 0.80, 0.85, 0.90, 0.95)'. Duplicate values are dropped. |
reference |
The baseline damping factor every other |
top_k |
Size of the top-scoring set used for the 'top_k_overlap' churn metric. Positive integer, default '10'. |
... |
Additional arguments forwarded to [damping_sensitivity()] and on to [pagerank()] (e.g. 'redirects_df', 'weight_col', 'algo', 'prior_df'). Passing 'damping' is an error, since 'alphas' drives the damping factor. |
A Spearman rank correlation near 1 across the whole grid means the choice of
damping factor is immaterial for this graph — the conventional '0.85' is as
good as any nearby value. A low correlation, or a top-k overlap well
below 1, flags a graph whose ranking is genuinely \alpha-sensitive and
worth investigating before trusting any single solve.
This is a thin orchestration layer: it performs no PageRank math of its own, delegating the solves to [damping_sensitivity()] and the rank-comparison statistics to [compare_pagerank()]. The 'reference' factor is always included in the sweep (even if absent from 'alphas') so it can serve as the comparison baseline; its own row is a sanity anchor ('spearman_rho = 1', 'mean_abs_delta = 0', 'top_k_overlap = 1').
A data frame with one row per swept \alpha (ascending), with
columns:
The damping factor.
Spearman rank correlation of this \alpha's
ranking against the reference, on their common nodes ('NA' if fewer
than 3 common nodes).
Mean absolute score difference vs the reference on common nodes.
Fraction in ‘[0, 1]' of the reference’s top-'k'
pages that are also in this \alpha's top-'k' (1 = identical top
set). The effective 'k' shrinks to the node count on small graphs.
Nodes present at this \alpha
but not the reference, and vice versa. Normally 0: varying
\alpha changes scores, not the node set.
The per-\alpha convergence metadata carried over from
[damping_sensitivity()].
The full per-(URL, \alpha) sensitivity frame from
[damping_sensitivity()] is attached as the '"sensitivity"' attribute, and
the 'reference' and 'top_k' used are attached as same-named attributes.
[damping_sensitivity()], [compare_pagerank()], [pagerank()] (the "Damping factor" section)
edges <- data.frame(
from = c("A", "B", "C", "A", "D"),
to = c("B", "C", "A", "C", "A")
)
stab <- pagerank_stability(edges, clean_edge_urls = FALSE)
print(stab)
# Drill into the per-(url, alpha) scores behind the summary.
head(attr(stab, "sensitivity"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.