Class SelectiveCommunityDetector

Inheritance Relationships

Derived Types

Class Documentation

class SelectiveCommunityDetector

Base class for selective community detection algorithms, i.e., algorithms that detect communities around a single node.

Subclassed by NetworKit::CliqueDetect, NetworKit::CombinedSCD, NetworKit::GCE, NetworKit::LFMLocal, NetworKit::LocalT, NetworKit::LocalTightnessExpansion, NetworKit::PageRankNibble, NetworKit::RandomBFS, NetworKit::TCE, NetworKit::TwoPhaseL

Public Functions

SelectiveCommunityDetector(const Graph &g)

Construct a selective community detector. This should only be called by child classes.


G – The graph for which communities shall be detected.

virtual ~SelectiveCommunityDetector() = default

Virtual default destructor to allow safe destruction of child classes.

virtual std::map<node, std::set<node>> run(const std::set<node> &seeds)

Detect one community for each of the given seed nodes.

The default implementation calls expandOneCommunity() for each of the seeds.


seeds – The list of seeds for which communities shall be detected.


a mapping from seed node to community (as a set of nodes)

virtual 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.

virtual 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 Graph *g