Skip to content

Extract node closeness

networkgraphcentrality

Calculcate network node closeness.

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 are the step's expected inputs and outputs and their specific types.

Step signature
extract_node_closeness(
    targets: list[number],
    *weights: list[number], {
    "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.

Example

Example call (in recipe editor)
extract_node_closeness(ds.targets, ds.weights) -> (ds.closeness)

Inputs


targets: column:list[number]

A column containing link targets. Source is implied in the index.


*weights: column:list[number]

An optional column containing link weights.

Outputs


closeness: column:number

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

Parameters


mode: string = "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.

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


normalized: boolean = 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.