coaffiliation: Community coaffiliation#

hypercoil.functional.graph.coaffiliation(C: Tensor, C_o: Tensor | None = None, L: Tensor | None = None, exclude_diag: bool = True, normalise_coaffiliation: bool = False) Tensor[source]#

Coaffiliation of vertices under a community structure.

Given community affiliation matrices \(C^{(i)} \in \mathbb{R}^{I \times C}\) for source nodes and \(C^{(o)} \in \mathbb{R}^{O \times C}\) for sink nodes, and given a matrix of inter-community coupling coefficients \(\Omega \in \mathbb{R}^{C \times C}\), the coaffiliation \(H \in \mathbb{R}^{I \times O}\) is computed as

\(H = C^{(i)} \Omega C^{(o)\intercal}\)

Dimension:
C_i : \((*, I, C)\)

* denotes any number of preceding dimensions, I denotes number of vertices in the source set, and C denotes the total number of communities in the proposed partition.

C_o : \((*, I, C)\)

O denotes number of vertices in the sink set. If the same set of vertices emits and receives edges, then \(I = O\).

L : \((*, C, C)\)

As above.

Output : \((*, I, O)\)

As above.

Parameters:
CTensor

Community affiliation of vertices in the source set. Each slice is a matrix \(C^{(i)} \in \mathbb{R}^{I \ times C}\) that encodes the uncertainty in each vertex’s community assignment. \(C^{(i)}_{jk}\) denotes the probability that vertex j is assigned to community k. If this is binary-valued, then it reflects a deterministic assignment.

C_oTensor or None (default None)

Community affiliation of vertices in the sink set. If None, then it is assumed that the source and sink sets are the same, and C_o is set equal to C_i.

LTensor or None (default None)

The inter-community coupling matrix \(\Omega\), mapping the probability of affiliation between communities. Each entry \(L_{ij}\) encodes the probability of a vertex in community i connecting with a vertex in community j. If None, then a strictly assortative structure is assumed (equivalent to L equals identity), under which nodes in the same community preferentially coaffiliate while nodes in different communities remain disaffiliated.

exclude_diagbool (default True)

Indicates that self-links are not factored into the coaffiliation.

normalise_coaffiliationbool (default False)

Normalise all community assignment weights to max out at 1.

Returns:
CTensor

Coaffiliation matrix for each input community structure.