Skip to main content

hits

Function hits 

Source
pub fn hits<G: Graph>(
    graph: &G,
    max_iter: usize,
    tol: f64,
) -> (Vec<f64>, Vec<f64>)
Expand description

HITS (Hyperlink-Induced Topic Search) algorithm.

Computes hub and authority scores for each node.

  • Authority score of v = sum of hub scores of in-neighbors of v.
  • Hub score of v = sum of authority scores of out-neighbors of v.

The neighbors function is interpreted as out-neighbors. The algorithm constructs an implicit transpose for the authority update.

Scores are L2-normalized after each iteration. Converges when the L2 change in both vectors is below tol, or after max_iter iterations.

Returns (hub_scores, authority_scores).

Time per iteration: O(V + E). Total: O(max_iter * (V + E)).