easygraph.functions.structural_holes.HAM module#

easygraph.functions.structural_holes.HAM.get_structural_holes_HAM(G, k, c, ground_truth_labels)[source]#

Structural hole spanners detection via HAM method.

Using HAM [1] to jointly detect SHS and communities.

Parameters:
  • G (easygraph.Graph) – An undirected graph.

  • k (int) – top - k structural hole spanners

  • c (int) – the number of communities

  • ground_truth_labels (list of lists) – The label of each node’s community.

Returns:

  • top_k_nodes (list) – The top-k structural hole spanners.

  • SH_score (dict) – The structural hole spanners score for each node, given by HAM.

  • cmnt_labels (dict) – The communities label of each node.

Examples

>>> get_structural_holes_HAM(G,
...                         k = 2, # To find top two structural holes spanners.
...                          c = 2,
...                          ground_truth_labels = [[0], [0], [1], [0], [1]] # The ground truth labels for each node - community detection result, for example.
...                         )

References