View source: R/hypergraph_measures.R
| hypergraph_measures | R Documentation |
Computes a comprehensive structural-statistics suite for a net_hypergraph: node-level, hyperedge-level, and global measures. All measures are derived in a few BLAS calls on the incidence matrix.
hypergraph_measures(hg)
## S3 method for class 'hypergraph_measures'
print(x, ...)
hg |
A |
x |
A |
... |
Additional arguments (ignored). |
All measures are computed via standard matrix operations on the binary
incidence B = (b_{ij}) where b_{ij} = 1 iff node i
is in hyperedge j:
hyperdegree = rowSums(B),
edge_sizes = colSums(B)
co_degree = tcrossprod(B) (with zero diagonal)
edge_pairwise_overlap = crossprod(B) (with zero diagonal)
overlap_coefficient[i, j] = overlap[i, j] / min(edge_sizes[i], edge_sizes[j])
jaccard[i, j] = overlap[i, j] / (edge_sizes[i] + edge_sizes[j] - overlap[i, j])
Empty hypergraph (n_hyperedges == 0) returns trivial zeros and
empty matrices.
An object of class hypergraph_measures (a named list) with
components:
n_nodes)hyperdegreeNumber of hyperedges containing each node.
node_strengthTotal participation: for node i,
\sum_{e \ni i} |e|. A node in many large hyperedges has
high strength.
max_edge_sizeSize of the largest hyperedge containing each node.
co_degreen_nodes x n_nodes matrix:
co_degree[i, j] = |{e : i, j in e}| (number of hyperedges
co-containing nodes i and j). Diagonal is zero.
n_hyperedges or m x m)edge_sizesHyperedge sizes |e|.
edge_pairwise_overlapm x m matrix:
|e_i intersect e_j|. Diagonal is zero.
overlap_coefficientm x m:
|e_i and e_j| / min(|e_i|, |e_j|). Measures how much the
smaller hyperedge is contained in the larger.
jaccardm x m: symmetric overlap index
|e_i and e_j| / |e_i union e_j|.
densityFor k-uniform hypergraphs: m / choose(n, k).
For mixed sizes: sum(|e|) / (n * m) (mean fraction of nodes
per hyperedge).
avg_edge_sizeMean of edge_sizes.
size_distributionTabulation of hyperedge sizes (passed
through from hg).
intersection_profileDistribution of pairwise hyperedge intersection sizes - useful for spotting whether hyperedges overlap mostly trivially or share substantial cores (Do et al. 2020).
pairwise_participationFraction of node pairs co-appearing in at least one hyperedge.
n_nodes, n_hyperedgesConvenience scalars.
The input x invisibly.
Lee, G., Choe, M., & Shin, K. (2024). A survey on hypergraph representation, learning and mining. Data Mining & Knowledge Discovery 37, 1-39.
Do, M. T., Yoon, S., Hooi, B., & Shin, K. (2020). Structural patterns and generative models of real-world hypergraphs. arXiv:2006.07060.
build_hypergraph(), bipartite_groups(),
clique_expansion().
df <- data.frame(
player = c("A", "B", "C", "A", "B", "D", "C", "D"),
session = c("S1", "S1", "S1", "S2", "S2", "S3", "S3", "S3")
)
hg <- bipartite_groups(df, "player", "session")
m <- hypergraph_measures(hg)
print(m)
m$hyperdegree # how many sessions each player joined
m$co_degree # pairwise co-membership counts
m$jaccard # symmetric overlap between sessions
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.