Class LFMLocal

Inheritance Relationships

Base Type

Class Documentation

class LFMLocal : public NetworKit::SelectiveCommunityDetector

Local version of the LFM algorithm

This is the local community expansion as introduced in:

Lancichinetti, A., Fortunato, S., & Kertész, J. (2009). Detecting the overlapping and hierarchical community structure in complex networks. New Journal of Physics, 11(3), 033015.

Their algorithm detects overlapping communities by repeatedly executing this algorithm for a random seed node that has not yet been assigned to any community.

The algorithm has a resolution parameter alpha. A natural choice for alpha is 1, the paper states that values below 0.5 usually give a community containing the whole graph while values larger than 2 recover the smallest communities.

Public Functions

LFMLocal(const Graph &g, double alpha = 1.0)

Construct the LFMLocal algorithm.

  • G – The graph to find a community on.

  • alpha – The resolution parameter.

virtual std::set<node> expandOneCommunity(const std::set<node> &s) override

Expand a set of nodes into a single community.


s – The set of seed nodes.


The found community.

std::set<node> expandOneCommunity(node seed)

Detect a community for the given seed node.

The default implementation calls expandOneCommunity(const std::set<node>&) with a set of one node.


seed – The seed to find the community for.


The found community as set of node.

std::set<node> expandOneCommunity(const std::set<node> &seeds) = 0

Detect a single community for the given seed nodes.

This is useful if you know multiple nodes that should be part of the community. This method may throw an exception if the particular algorithm does not support multiple seeds.


seeds – The seeds for the community.


The found community as set of nodes.

Protected Attributes

const double alpha