easygraph.functions.structural_holes.metrics module#
- easygraph.functions.structural_holes.metrics.nodes_of_max_cc_without_shs(G, S)[source]#
Returns the number of nodes in the maximum connected component in graph GS. The experiment ml_metrics in [1]
- Parameters:
G (easygraph.Graph or easygraph.DiGraph) –
S (list of int) – A list of nodes witch are structural hole spanners.
- Returns:
G_S_nodes_of_max_CC – The number of nodes in the maximum connected component in graph GS.
- Return type:
int
Examples
>>> G_t=eg.datasets.get_graph_blogcatalog() >>> S_t=eg.AP_Greedy(G_t, 10000) >>> maxx = nodes_of_max_cc_without_shs(G_t, S_t) >>> print(maxx)
References
- easygraph.functions.structural_holes.metrics.structural_hole_influence_index(G_original, S, C, model, variant=False, seedRatio=0.05, randSeedIter=10, countIterations=100, Directed=True)[source]#
Returns the SHII metric of each seed.
- Parameters:
G_original (easygraph.Graph or easygraph.DiGraph) –
S (list of int) – A list of nodes which are structural hole spanners.
C (list of list) – Each list includes the nodes in one community.
model (string) – Propagation Model. Should be IC or LT.
variant (bool, default is False) – Whether returns variant SHII ml_metrics or not. variant SHII = # of the influenced outsider / # of the influenced insiders SHII = # of the influenced outsiders / # of the total influenced nodes
seedRatio (float, default is 0.05) – # of sampled seeds / # of nodes of the community that the given SHS belongs to.
randSeedIter (int, default is 10) – How many iterations to sample seeds.
countIterations (int default is 100) – Number of monte carlo simulations to be used.
Directed (bool, default is True) – Whether the graph is directed or not.
- Returns:
seed_shii_pair – the SHII metric of each seed
- Return type:
dict
Examples
# >>> structural_hole_influence_index(G, [3, 20, 9], Com, ‘LT’, seedRatio=0.1, Directed=False)
References
- easygraph.functions.structural_holes.metrics.sum_of_shortest_paths(G, S)[source]#
Returns the difference between the sum of lengths of all pairs shortest paths in G and the one in GS. The experiment ml_metrics in [1]
- Parameters:
G (easygraph.Graph or easygraph.DiGraph) –
S (list of int) – A list of nodes witch are structural hole spanners.
- Returns:
differ_between_sum – The difference between the sum of lengths of all pairs shortest paths in G and the one in GS. C(G/S)-C(G)
- Return type:
int
Examples
>>> G_t=eg.datasets.get_graph_blogcatalog() >>> S_t=eg.AP_Greedy(G_t, 10000) >>> diff = sum_of_shortest_paths(G_t, S_t) >>> print(diff)
References