Skip to main content
Calculates the closeness centrality for each node in the network. Closeness centrality is a measure of how many steps are required to access every other vertex from a given vertex. In other words, it finds the nodes best placed to influence the entire network most quickly.

Usage

The following example shows how the step can be used in a recipe.

Examples

  • Example 1
  • Signature
extract_node_closeness(ds.targets, ds.weights) -> (ds.closeness)

Inputs & Outputs

The following are the inputs expected by the step and the outputs it produces. These are generally columns (ds.first_name), datasets (ds or ds[["first_name", "last_name"]]) or models (referenced by name e.g. "churn-clf").
targets
column[list[number]]
required
A column containing link targets. Source is implied in the index.
*weights
column[list[number]]
An optional column containing link weights.
closeness
column[number]
required
Column containing how many steps is required to access every other vertex from a given vertex.

Configuration

The following parameters can be used to configure the behaviour of the step by including them in a json object as the last “input” to the step, i.e. step(..., {"param": "value", ...}) -> (output).

Parameters

mode
string
default:"all"
Which node connections to count. Whether to
  • in: count only a node’s incoming links
  • out: count only a node’s outgoing links
  • all/both count both incoming and outgoing links.
Values must be one of the following:
  • all
  • out
  • in
  • both
normalized
boolean
default:"true"
Whether to calculate the normalized closeness.
cutoff
[number, null]
The maximum path length to consider when calculating the betweenness. If cutoff is zero or negative then there is no such limit.
I