cdlib.algorithms.ga

cdlib.algorithms.ga(g_original: object, population: int = 300, generation: int = 30, r: float = 1.5) NodeClustering

Genetic based approach to discover communities in social networks. GA optimizes a simple but efficacious fitness function able to identify densely connected groups of nodes with sparse connections between groups.

Supported Graph Types

Undirected

Directed

Weighted

Yes

No

No

Parameters:
  • g_original – a networkx/igraph object

  • population

  • generation

  • r

Returns:

NodeClustering object

Example:

>>> from cdlib import algorithms
>>> import networkx as nx
>>> G = nx.karate_club_graph()
>>> coms = algorithms.ga(G)
References:

Pizzuti, C. (2008). Ga-net: A genetic algorithm for community detection in social networks. In Inter conf on parallel problem solving from nature, pages 1081–1090.Springer.

Note

Reference implementation: https://github.com/hariswb/ga-community-detection