This module implements community detection.
To handle several data in one struct.
Could be replaced by named tuple, but don’t want to depend on python 2.6
Compute the partition of the graph nodes which maximises the modularity (or try..) using the Louvain heuristices
| Parameters: |
|
|---|---|
| Return type: | dictionary |
| Returns: | The partition, with communities numbered from 0 to number of communities |
Find communities in the graph and return the associated dendogram
| Parameters: |
|
|---|---|
| Return type: | list of dictionaries |
| Returns: | a list of partitions, ie dictionnaries where keys of the i+1 are the values of the i. and where keys of the first are the nodes of graph |
Produce the graph where nodes are the communities
there is a link of weight w between communities if the sum of the weights of the links between their elements is w
| Parameters: |
|
|---|---|
| Return type: | networkx.Graph |
| Returns: | a networkx graph where nodes are the parts |
Load binary graph as used by the cpp implementation of this algorithm
| Parameter: | data (string or file) – the file containing the data |
|---|---|
| Return type: | networkx.Graph |
| Returns: | The graph |
Compute the modularity of a partition of a graph
| Parameters: |
|
|---|---|
| Return type: | float |
| Returns: | The modularity |
Compute one level of communities
| Parameters: |
|
|---|---|
| Returns: | nothing, the status is modified during the function |
Return the partition of the nodes at the given level
Level 0 is the first partition, and the best is len(dendogram) - 1
| Parameters: |
|
|---|---|
| Return type: | dictionary |
| Returns: | a dictionary where keys are the nodes and the values are the set it belongs to |
Renumber the values of the dictionary from 0 to n
| Parameter: | dictionary (dictionary) – the partition |
|---|---|
| Return type: | dictionary |
| Returns: | The modified partition |