Tracker | R Documentation |
R6 class to manage personalized pagerank calculations
R6 class to manage personalized pagerank calculations
seeds
A character vector of the seed nodes.
path
A character vector of nodes whose neighborhoods we examined.
stats
A tibble::tibble()
with one row for each visited
node and the following columns:
name
: Name of a node (character).
r
: Current estimate of residual per out-degree for a node.
p
: Current estimate of the pagerank for a node.
in_degree
: Number of incoming edges to a node.
out_degree
: Number of outcoming edges from a node.
failed
A character vector of nodes that could not be visited.
graph
An abstract graph object.
alpha
Teleportation constant from Algorithm 3.
alpha_prime
Transformed teleportation constant from Algorithm 3.
epsilon
Error tolerance.
max_visits
Maximum number of nodes to visit before terminating.
tau
Regularization parameter used in Algorithm 4.
new()
Create a new Tracker object.
Tracker$new(graph, alpha, epsilon, tau, max_visits)
graph
See appr()
.
alpha
See appr()
.
epsilon
See appr()
.
tau
See appr()
.
max_visits
See appr()
.
A new Tracker
object.
print()
Print the tibble containing the current state of the pagerank calculation.
Tracker$print()
remaining()
Determine nodes that need to be visited. Note that, if there is a node with zero out degree, you will never leave from that node. So it is important to make sure we never add nodes with zero out degree into the tracker.
Tracker$remaining()
A character vector of node names with current residuals
greater than epsilon
.
current_approximation_error()
Determine current quality of approximation.
Tracker$current_approximation_error()
A numeric vector of length one with the current worst error bound.
in_tracker()
Check if there is already a row for a particular node
Tracker$in_tracker(nodes)
nodes
Character name of node(s) in the graph.
TRUE
if there is a row for node
, FALSE
if there
is not a row for node
.
in_failed()
Check if we previously failed to visit a node
Tracker$in_failed(node)
node
Character name of a node in the graph.
TRUE
if we failed to visit node
, FALSE
otherwise.
Note that this function will return FALSE
if node
is new
and we haven't seen it before.
add_seed()
Create an entry for node
in the tracker. Assumes that
node
is not in the tracker yet, and does not check if
this is the case.
Tracker$add_seed(seeds, preference)
seeds
The name of the node in the graph as a length 1 character vector.
preference
TODO: recall what on earth this is.
add_to_path()
TODO
Tracker$add_to_path(node)
node
The name of the node in the graph as a length 1 character vector.
add_nodes()
Create an entry for node
in the tracker. Assumes that
node
is not in the tracker yet, and does not check if
this is the case.
Tracker$add_nodes(nodes, preference = 0)
nodes
The name(s) of node(s) in the graph as a character vector.
preference
TODO: recall what on earth this is.
add_failed()
Add node
to the list of nodes we failed to visit.
Assumes that node
is not in the failed list yet, and
does not check if this is the case.
Tracker$add_failed(nodes)
nodes
The name of the node in the graph as a length 1 character vector.
update_p()
Update the estimate of the personalized pagerank for a given node
Tracker$update_p(node)
node
Character name of a node in the graph.
update_r_neighbor()
Update the residual of a good node in the neighborhood of the current node, adding it to the tracker if necessary
Tracker$update_r_neighbor(u, v)
u
Character name of the node we are currently visiting.
v
Names of neighbors of u
as a character vector. Can
contain multiple elements. Can also contain zero elements.
update_r_self()
Update the residual of current node
Tracker$update_r_self(node)
node
Character name of the node we are currently visiting.
regularize()
Compute the degree-adjusted and regularized variants of personalized PageRank as in Algorithm 4, based on the outputs of Algorithm 3.
Tracker$regularize()
node
Character name of the node we are currently visiting.
calculate_ppr()
Main driver function to perform the computations outlined in Algorithm 3.
Tracker$calculate_ppr()
node
Character name of the node we are currently visiting.
clone()
The objects of this class are cloneable with this method.
Tracker$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.