Warning

This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.

networkx.algorithms.community.asyn_fluid.asyn_fluidc

asyn_fluidc(G, k, max_iter=100, seed=None)[source]

Returns communities in G as detected by Fluid Communities algorithm.

The asynchronous fluid communities algorithm is described in [1]. The algorithm is based on the simple idea of fluids interacting in an environment, expanding and pushing each other. It’s initialization is random, so found communities may vary on different executions.

The algorithm proceeds as follows. First each of the initial k communities is initialized in a random vertex in the graph. Then the algorithm iterates over all vertices in a random order, updating the community of each vertex based on its own community and the communities of its neighbours. This process is performed several times until convergence. At all times, each community has a total density of 1, which is equally distributed among the vertices it contains. If a vertex changes of community, vertex densities of affected communities are adjusted immediately. When a complete iteration over all vertices is done, such that no vertex changes the community it belongs to, the algorithm has converged and returns.

This is the original version of the algorithm described in [1]. Unfortunately, it does not support weighted graphs yet.

Parameters:
  • G (Graph)
  • k (integer) – The number of communities to be found.
  • max_iter (integer) – The number of maximum iterations allowed. By default 15.
  • seed (integer, random_state, or None (default)) – Indicator of random number generation state. See Randomness.
Returns:

communities – Iterable of communities given as sets of nodes.

Return type:

iterable

Notes

k variable is not an optional argument.

References

[1](1, 2) Parés F., Garcia-Gasulla D. et al. “Fluid Communities: A Competitive and Highly Scalable Community Detection Algorithm”. [https://arxiv.org/pdf/1703.09307.pdf].