pub fn cocitation(graph: &Graph) -> IgraphResult<Vec<u32>>Expand description
Computes the cocitation scores between all pairs of vertices.
Two vertices are cocited if there is a third vertex citing (having
outgoing edges to) both. The cocitation score of vertices u and v
is the number of vertices that have edges to both u and v.
For undirected graphs, this equals the number of common neighbors.
Returns a flat vector of length n * n in row-major order, where
result[u * n + v] is the cocitation count for the pair (u, v).
§Examples
use rust_igraph::{Graph, cocitation};
// 2 → 0, 2 → 1 means vertices 0 and 1 are cocited by vertex 2
let mut g = Graph::new(3, true).unwrap();
g.add_edge(2, 0).unwrap();
g.add_edge(2, 1).unwrap();
let scores = cocitation(&g).unwrap();
assert_eq!(scores[0 * 3 + 1], 1); // cocitation(0,1) = 1
assert_eq!(scores[1 * 3 + 0], 1); // symmetric