
Calculate Player Network Centrality from Database
Source:R/centrality_storage.R
calculate_player_centrality.RdHigh-level function that loads delivery data from the database and computes network centrality quality scores for all players. This is the preferred method over PageRank as it better separates elite players from isolated clusters.
Usage
calculate_player_centrality(
conn,
format = "t20",
gender = "male",
min_deliveries = CENTRALITY_MIN_DELIVERIES,
alpha = CENTRALITY_ALPHA,
verbose = TRUE
)Arguments
- conn
DBI connection to the bouncer database.
- format
Character. Match format: "t20", "odi", "test", or "all".
- gender
Character. Gender filter: "male", "female", or "all".
- min_deliveries
Integer. Minimum deliveries for inclusion.
- alpha
Numeric. Opsahl's alpha parameter (default 0.5 = geometric mean).
- verbose
Logical. Print progress messages.
Value
List with:
batters: Data frame with batter centrality results
bowlers: Data frame with bowler centrality results
matrices: The underlying matchup matrices
algorithm: Algorithm metadata (format, gender, alpha)
Examples
if (FALSE) { # \dontrun{
conn <- get_db_connection(read_only = TRUE)
cent <- calculate_player_centrality(conn, format = "t20")
head(cent$batters[order(-cent$batters$centrality), ])
DBI::dbDisconnect(conn, shutdown = TRUE)
} # }