Skip to contents

Computes distribution metrics for each model in a [pagerank_grid()] result, producing a one-row-per-model summary. Useful for quickly comparing how different parameter configurations affect the shape of the PageRank distribution.

Usage

analyze_pagerank_grid(
  grid_result,
  model_id_col = "model_id",
  pr_col = "pagerank"
)

Arguments

grid_result

A data frame returned by [pagerank_grid()], with columns `model_id`, a node column, and a PageRank value column.

model_id_col

Name of the model identifier column. Default `"model_id"`.

pr_col

Name of the PageRank value column. Default `"pagerank"`.

Value

A data frame with one row per model and the following columns:

model_id

Model identifier

num_nodes

Number of nodes in the model

pr_sum

Sum of PageRank scores (1 for standard graphs, less when evaporation or vanish is active)

pr_max

Maximum PageRank score

pr_gini

Gini coefficient (see [pr_gini()])

pr_entropy

Shannon entropy (see [pr_entropy()])

pr_top10_share

Share of total PR held by the top 10 percent of nodes (see [pr_top_k_share()])

Examples

edges <- data.frame(
  from = c("A", "B", "C", "A"),
  to = c("B", "C", "A", "C")
)
params <- list(
  low = list(damping = 0.5),
  high = list(damping = 0.95)
)
grid <- pagerank_grid(edges, params, clean_edge_urls = FALSE)
analyze_pagerank_grid(grid)
#>   model_id num_nodes pr_sum    pr_max    pr_gini pr_entropy pr_top10_share
#> 1      low         3      1 0.3846154 0.08547009   1.084244      0.3846154
#> 2     high         3      1 0.3992712 0.12967783   1.058139      0.3992712