teneto.communitydetection

Louvain

make_consensus_matrix(com_membership, th=0.5)[source]

Makes the consensus matrix.

From multiple iterations, finds a consensus partition.

.
com_membership : array
Shape should be node, time, iteration.
th : float
threshold to cancel noisey edges
D : array
consensus matrix
make_temporal_consensus(com_membership)[source]

Matches community labels accross time-points.

Jaccard matching is in a greedy fashiong. Matching the largest community at t with the community at t-1.

Parameters:com_membership (array) – Shape should be node, time.
Returns:D – temporal consensus matrix using Jaccard distance
Return type:array
temporal_louvain(tnet, resolution=1, intersliceweight=1, n_iter=100, negativeedge='ignore', randomseed=None, consensus_threshold=0.5, temporal_consensus=True, njobs=1)[source]

Louvain clustering for a temporal network.

Parameters:
  • tnet (array, dict, TemporalNetwork) – Input network
  • resolution (int) – resolution of Louvain clustering ($gamma$)
  • intersliceweight (int) – interslice weight of multilayer clustering ($omega$). Must be positive.
  • n_iter (int) – Number of iterations to run louvain for
  • randomseed (int) – Set for reproduceability
  • negativeedge (str) – If there are negative edges, what should be done with them. Options: ‘ignore’ (i.e. set to 0). More options to be added.
  • consensus (float (0.5 default)) – When creating consensus matrix to average over number of iterations, keep values when the consensus is this amount.
Returns:

communities – node,time array of community assignment

Return type:

array (node,time)

Notes

References