easygraph.functions.structural_holes.AP_Greedy module#

easygraph.functions.structural_holes.AP_Greedy.AP_Greedy(G, k, c=1.0, weight='weight')[source]#

AP greedy method for structural hole spanners detection.

Returns top k nodes as structural hole spanners, Algorithm 2 of [1]

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

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

  • c (float, optional (default : 1.0)) – To define zeta: zeta = c * (n*n*n), and zeta is the large value assigned as the shortest distance of two unreachable vertices. Default is 1.

  • weight (String or None, optional (default : 'weight')) – Key for edge weight. None if not concerning about edge weight.

Returns:

AP_greedy – The list of each top-k structural hole spanners.

Return type:

list

Examples

Returns the top k nodes as structural hole spanners, using AP_greedy.

>>> AP_greedy(G,
...           k = 3, # To find top three structural holes spanners.
...           c = 1.0, # To define zeta: zeta = c * (n*n*n), and zeta is the large value assigned as the shortest distance of two unreachable vertices.
...           weight = 'weight')

References

easygraph.functions.structural_holes.AP_Greedy.common_greedy(G, k, c=1.0, weight='weight')[source]#

Common greedy method for structural hole spanners detection.

Returns top k nodes as structural hole spanners, Algorithm 1 of [1]

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

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

  • c (float, optional (default : 1.0)) – To define zeta: zeta = c * (n*n*n), and zeta is the large value assigned as the shortest distance of two unreachable vertices. Default is 1.

  • weight (String or None, optional (default : 'weight')) – Key for edge weight. None if not concerning about edge weight.

Returns:

common_greedy – The list of each top-k structural hole spanners.

Return type:

list

See also

AP_Greedy

Examples

Returns the top k nodes as structural hole spanners, using common_greedy.

>>> common_greedy(G,
...               k = 3, # To find top three structural holes spanners.
...               c = 1.0, # To define zeta: zeta = c * (n*n*n), and zeta is the large value assigned as the shortest distance of two unreachable vertices.
...               weight = 'weight')

References