Skip to main content

degree_centrality

docs-source

Abstract

Degree Centrality is the basic measurement of centrality that refers to the number of edges adjacent to a node. For directed graphs, we define an in-degree measure, which is defined as the number of in-coming edges, and an out-degree measure, defined as the number of out-going edges.

Let $A = (a{i,j})$ be the adjacency matrix of a directed graph. The in-degree centrality $x{i}$ of node $i$ is given by: $$x{i} = \sum_k a{k,i}$$ or in matrix form (1 is a vector with all components equal to unity): $$x = 1 A$$ The out-degree centrality $y{i}$ of node $i$ is given by: $$y{i} = \sumk a{i,k}$$ or in matrix form: $$y = A 1$$

TraitValue
Module typealgorithm
ImplementationC++
Graph directiondirected/undirected
Edge weightsunweighted
Parallelismsequential

Procedures

get(type)

Output:

  • node ➡ Node in the graph, for which Degree Centrality is calculated.
  • degree ➡ Calculated degree of a node.

Usage:

CALL degree_centrality.get()
YIELD node, degree;

get_subgraph(nodes, relationships, type)

Input:

  • nodes: list[node] ➡ nodes to be used in the algorithm.
  • relationships: list[relationship] ➡ relationships to be considered for degree calculation.
  • type: string (default="undirected") ➡ whether we are using "in", "out", or "undirected" edges.

Output:

  • node ➡ Node in the graph, for which Degree Centrality is calculated.
  • degree ➡ Calculated degree of a node.

Usage:

CALL degree_centrality.get()
YIELD node, degree;

Example