Skip to content

Extract node closeness


Calculcate network node closeness.


extract_node_closeness(links) -> (ds.closeness)


The following are the step's expected inputs and outputs and their specific types.

extract_node_closeness(links: dataset, {"param": value}) -> (closeness: number)

where the object {"param": value} is optional in most cases and if present may contain any of the parameters described in the corresponding section below.


links: dataset

A dataset of links between nodes, i.e. containing source, target and weight columns.


closeness: column:number

Column containing how many steps is required to access every other vertex from a given vertex.


  • If cutoff is zero or negative then there is no such limit.
  • If the graph has a weight edge attribute, then this is used by default. Weights are used to calculate weighted shortest paths, so they are interpreted as distances.
  • Mode defines the types of the paths used for measuring the distance in directed graphs. “in” measures the paths to a vertex, “out” measures paths from a vertex, all uses undirected paths. This argument is ignored for undirected graphs.

mode: string = "all"

Which node connections to count.

Must be one of: "all", "out", "in", "both"

Example parameter values:

  • "all"
  • "out"
  • "in"
  • "both"

normalized: boolean = True

Whether to calculate the normalized closeness.

Example parameter values:

  • false
  • true

cutoff: number | null

The maximum path length to consider when calculating the betweenness.

Example parameter values:

  • 2

weights: string | null

Optional Column name containing positive weights for calculating weighted betweenness.