| compute_hits | R Documentation |
Builds a directed graph from a processed edge list and computes Kleinberg's HITS hub and authority scores using 'igraph::hits_scores()' (the non-deprecated successor of 'igraph::hub_score()' / 'igraph::authority_score()'). This is the low-level computational core; the high-level [hits()] wrapper runs the URL-cleaning, redirect/canonical folding, domain filtering, deduplication, and isolate handling identity pipeline first.
compute_hits(
edge_list_df,
vertices_df = NULL,
from_col = "from",
to_col = "to",
vertex_col_name = "node_name",
weight_col = NULL,
weight_validation = c("error", "warning", "none"),
scale = TRUE,
pr_node_col = "node_name",
hub_col = "hub",
authority_col = "authority",
...
)
edge_list_df |
A data frame representing the processed edge list, with source/target columns (see 'from_col', 'to_col'). NAs in those columns are omitted before graph construction. |
vertices_df |
An optional single-column data frame of node names defining the vertex set (e.g. to retain isolates). If 'NULL' (default), the vertices are inferred from 'edge_list_df'. The column name is given by 'vertex_col_name'. |
from_col, to_col |
Names of the source/target columns in 'edge_list_df'. Defaults '"from"' / '"to"'. |
vertex_col_name |
Name of the node column in 'vertices_df'. Default '"node_name"'. |
weight_col |
Optional name of a numeric edge-weight column. Higher weights give an edge more influence in the hub/authority mutual reinforcement. If 'NULL' (default), the graph is unweighted. |
weight_validation |
How invalid edge weights are handled when 'weight_col' is supplied: '"error"' (default), '"warning"', or '"none"'. See [validate_edge_weights()]. |
scale |
Logical, passed to 'igraph::hits_scores()'. When 'TRUE' (default) each score vector is scaled so its maximum entry is '1', the conventional HITS reporting convention. When 'FALSE' the raw principal eigenvectors (unit Euclidean norm) are returned. |
pr_node_col |
Name for the node column in the output. Default '"node_name"' (kept consistent with [compute_pagerank()]). |
hub_col, authority_col |
Names for the hub and authority score columns in the output. Defaults '"hub"' / '"authority"'. |
... |
Additional arguments passed to 'igraph::hits_scores()' (e.g. 'options'). |
## Matrix formulation
Let A be the adjacency matrix of the directed graph (A_{ij} = 1
when page i links to page j, or the edge weight when weighted).
HITS computes two mutually reinforcing scores as the dominant eigenvectors:
**authority** is the dominant eigenvector of A^\top A: a page
is a good authority when it is pointed to by good hubs.
**hub** is the dominant eigenvector of A A^\top: a page is a
good hub when it points to good authorities.
'igraph::hits_scores()' solves these eigenproblems directly, so no separate direction flip is needed: authority is the inflow-oriented score and hub is the outflow-oriented score, both returned from a single call.
A data frame with three columns: the node name (named by 'pr_node_col') and the hub and authority scores (named by 'hub_col' / 'authority_col'). Returns an empty (zero-row) data frame with those columns when the graph has no vertices.
[hits()] for the full identity pipeline; [compute_pagerank()] for the PageRank analog.
edges <- data.frame(
from = c("A", "A", "B"), to = c("B", "C", "C")
)
compute_hits(edges)
# Retain an isolate via vertices_df (scores 0 for both hub and authority)
verts <- data.frame(node_name = c("A", "B", "C", "D"))
compute_hits(edges, vertices_df = verts)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.