Class TopHarmonicCloseness

Inheritance Relationships

Base Type

Class Documentation

class TopHarmonicCloseness : public NetworKit::Algorithm

Public Functions

explicit TopHarmonicCloseness(const Graph &G, count k = 1, bool useNBbound = false)

Finds the top k nodes with highest harmonic closeness centrality faster than computing it for all nodes. The implementation is based on “Computing Top-k Centrality Faster in Unweighted Graphs”, Bergamini et al., ALENEX16. The algorithm also works with weighted graphs but only with the NBcut variation. We recommend to use useNBbound = false for (weighted) complex networks (or networks with small diameter) and useNBbound = true for street networks (or networks with large diameters). Notice that the worst case running time of the algorithm is O(nm), where n is the number of nodes and m is the number of edges. However, for most real-world networks the empirical running time is O(m).

Parameters:
  • G – The input graph. If useNBbound is set to true, edge weights will be ignored.

  • k – Number of nodes with highest harmonic closeness that have to be found. For example, k = 10, the top 10 nodes with highest harmonic closeness will be computed.

  • useNBbound – If true, the NBbound variation will be used, otherwise NBcut.

~TopHarmonicCloseness() override
virtual void run() override

Computes top-k harmonic closeness on the graph passed in the constructor.

std::vector<node> topkNodesList(bool includeTrail = false)

Returns a list with the k nodes with highest harmonic closeness. WARNING: closeness centrality of some nodes below the top-k could be equal to the k-th closeness, we call them trail. Set the parameter includeTrail to true to also include those nodes but consider that the resulting vector could be longer than k.

Parameters:

includeTrail – Whether or not to include trail nodes.

Returns:

The list of the top-k nodes.

std::vector<edgeweight> topkScoresList(bool includeTrail = false)

Returns a list with the scores of the k nodes with highest harmonic closeness. WARNING: closeness centrality of some nodes below the top-k could be equal to the k-th closeness, we call them trail. Set the parameter includeTrail to true to also include those centrality values but consider that the resulting vector could be longer than k.

Parameters:

includeTrail – Whether or not to include trail centrality value.

Returns:

The closeness centralities of the k most central nodes.

inline void restrictTopKComputationToNodes(const std::vector<node> &nodeList)

Restricts the top-k harmonic closeness computation to a subset of nodes. If the given list is empty, all nodes in the graph will be considered. Note: Actual existence of included nodes in the graph is not checked.

Parameters:

nodeList – Subset of nodes.