ash_model.measures.s_local_clustering_coefficient¶
- ash_model.measures.s_local_clustering_coefficient(h, s, hyperedge_id, start=None, end=None)[source]¶
Compute the local clustering coefficient of a hyperedge within the s-overlap line graph of a hypergraph.
The local clustering coefficient is defined as the ratio of the number of edges actually present among the neighbors of the given node to the maximum possible number of edges among those neighbors.
- Parameters:
- Returns:
local clustering coefficient in [0,1]
- Return type:
Examples
>>> import numpy as np, networkx as nx >>> from ash_model.utils.networkx import from_networkx_maximal_cliques_list >>> Gs = [nx.barabasi_albert_graph(100, 3, seed=i) for i in range(10)] >>> rng = np.random.default_rng(42) >>> for G in Gs: ... for n in G.nodes(): ... G.nodes[n]['color'] = 'red' if rng.integers(0, 2) == 0 else 'blue' >>> h = from_networkx_maximal_cliques_list(Gs) >>> tid = 0 >>> he0 = next(iter(h.hyperedges(start=tid, end=tid))) >>> round(s_local_clustering_coefficient(h, 1, he0, start=tid, end=tid), 12) 0.801169590643