sospcat.social

This module defines the methods for social community detection.

get_groups(a_graph, method='component_infomap', return_form='membership')[source]

Return the grouping of the provided graph object using the specified method. The grouping is returned as a list of sets each holding all members of a group.

Parameters
  • a_graph (igraph.Graph) – The graph to partition

  • method (str (default='component_infomap')) – String specifying which method to use. If two methods should be used one after the other they should be separated by _. Default: ‘component_infomap’ which will first consider all disconnected components as groups then apply infomap on all of those groups to optionally further split.

  • return_form (str (default='membership')) –

    Determines the format of how the social group structure should be returned. Options are:

    • 'membership': A list returning for each index node the group it belongs to.

    • 'memberlists': Dictionary with a list of members value for each group key.

Returns

Depending on what was chosen for the return_form attribute, either the membership dict, i.e.:

{
    node_id: group_id,
    ...
}

or the memberlist dict, i.e.:

{
    group_id: [node1_id, node2_id, ...],
    ...
}

(value) is returned.

Return type

dict