Class Assortativity

Inheritance Relationships

Base Type

Class Documentation

class Assortativity : public NetworKit::Algorithm

Assortativity computes a coefficient that expresses the correlation of a node attribute among connected pairs of nodes.

For a partition of the node set (a nominal attribute), the coefficient is computed from the mixing matrix e, where e_ij is the fraction of edge counts from nodes in subset i to nodes in subset j. In undirected graphs, each edge {u, v} with u != v is counted once in each direction and each self-loop is counted once, and the mixing matrix is normalized by the total of these counts (2m minus the number of self-loops). In directed graphs, each edge is counted once and the matrix is normalized by m.

Public Functions

Assortativity(const Graph &G, const std::vector<double> &attribute)

Initialize Assortativity with a graph G and an array of numerical node values.

Parameters:
  • G – The graph.

  • attribute – numerical node value array

Assortativity(const Graph &G, const Partition &partition)

Initialize Assortativity with a graph G and a partition of the node set

Parameters:
  • G – The graph.

  • partition – partition of the node set

virtual void run() override

Runs the algorithm. The algorithm is not parallel.

double getCoefficient() const

Return the assortativity coefficient.