appr | R Documentation |
Computes the personalized pagerank for specified seeds using the
ApproximatePageRank
algorithm of Andersen et al. (2006). Computes
degree-adjustments and degree-regularization of personalized
pagerank vectors as described in Algorithms 3 and 4 of Chen et al. (2019).
These algorithms are randomized; if results are unstable across
multiple runs, decrease epsilon
.
appr(
graph,
seeds,
...,
alpha = 0.15,
epsilon = 1e-06,
tau = NULL,
max_visits = Inf
)
## S3 method for class 'igraph'
appr(graph, seeds, ...)
## S3 method for class 'rtweet_graph'
appr(graph, seeds, ...)
graph |
An |
seeds |
A character vector of seeds for the personalized pagerank.
The personalized pagerank will return to each of these seeds with
probability |
... |
Ignored. Passing arguments to |
alpha |
Teleportation constant. The teleportation constant is the
probability of returning to a seed node at each node transition.
|
epsilon |
Desired accuracy of approximation. For Twitter graphs, we recommend testing your code with Anytime you would like to explore more of the graph, you can simply
decrease Also note that runtime is proportional to |
tau |
Regularization term. Additionally inflates the in-degree
of each observation by this term by performing the degree
adjustment described in Algorithm 3 and Algorithm 4, which
are described in |
max_visits |
Maximum number of unique nodes to visit. Should be a
positive integer. Defaults to |
A Tracker()
object. Most relevant is the stats
field,
a tibble::tibble()
with the following columns:
name
: Name of a node (character).
p
: Current estimate of residual per out-degree for a node.
r
: Estimated error of pagerank estimate for a node.
in_degree
: Number of incoming edges to a node.
out_degree
: Number of outcoming edges from a node.
degree_adjusted
: The personalized pagerank divided by the
node in-degree.
regularized
: The personalized pagerank divide by the node
in-degree plus tau
.
When computing personalized pageranks for Twitter users (either
via rtweet_graph()
, name
is given
as a user ID, not a screen name, regardless of how the seed nodes
were specified.
Chen, Fan, Yini Zhang, and Karl Rohe. “Targeted Sampling from Massive Block Model Graphs with Personalized PageRank.” Journal of the Royal Statistical Society: Series B (Statistical Methodology) 82, no. 1 (February 2020): 99–126. https://doi.org/10.1111/rssb.12349.
Andersen, Reid, Fan Chung, and Kevin Lang. “Local Graph Partitioning Using PageRank Vectors.” In 2006 47th Annual IEEE Symposium on Foundations of Computer Science (FOCS’06), 475–86. Berkeley, CA, USA: IEEE, 2006. https://doi.org/10.1109/FOCS.2006.44.
library(aPPR)
library(igraph)
set.seed(27)
graph <- rtweet_graph()
## Not run:
appr(graph, "alexpghayes")
## End(Not run)
graph2 <- sample_pa(100)
# this creates a Tracker object
ppr_results <- appr(graph2, seeds = "5")
# the portion of the Tracker object you probably care about
ppr_results$stats
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.