Skip to content

Layout network

network

Compute a force-directed graph layout with a fast forceAtlas2 implementation.

Applies a clustering algorithm after vectorizing the input dataset (converting its columns to numeric-only and no missing data), and optionally reducing its dimensionality.

Essentially applies the separate step vectorize_dataset, followed by a clustering algorithm (HDBSCAN by default). The result is a column of cluster IDs.

Example

Note that the links dataset used as input has to be compatible with the dataset the x and y positions are assigned to. I.e. in the example below, the links dataset should have been derived from the ds dataset using a step of the link_[x] kind.

layout_network(links, {scalingRatio: 0.8, linLogMode: false}) -> (ds.x, ds.y)

Usage

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

layout_network(links: dataset, {"param": value}) -> (x: number, y: 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.

Inputs


links: dataset

A Dataset of links (having source, target and weight columns). Usually generated using a prior link_[x] step.

Outputs


x: column:number

A quantitative Column containing the x coordinate of each node's position in the network.


y: column:number

A quantitative Column containing the y coordinate of each node's position in the network.

Parameters


gravity: number = 0.05

Attracts nodes to the center. Prevents islands from drifting away.

Example parameter values:

  • 0.05

scalingRatio: number = 0.8

The amount of repulsion. Greater values lead to a larger and more sparse graph.

Example parameter values:

  • 0.8

barnesHutTheta: number = 1.0

Algorithmic "resolution". Greater values lead to faster execution at the expense of less precise calculations.

Range: 0.0 ≤ barnesHutTheta ≤ 2.0


avoidHubs: boolean = False

Prefer authorities over hubs. Prefer "authorities" (nodes with a high indegree) over hubs (nodes with a high outdegree). Authorities will have more central and hubs more peripheral positions. (default=false).

Example parameter values:

  • false

linLogMode: boolean = False

Usually produces tighter clusters. Enabling it may also require adjusting the scalingRatio.

Example parameter values:

  • false

avoidOverlap: boolean = False

Try to avoid overlap between nodes.

Example parameter values:

  • false

iterations: integer = 500

The more the better, though it will take longer.

Example parameter values:

  • 300

nodeSize: number = 1.0

How much space to (try and) give each node in the final layout.

Range: 1.0 ≤ nodeSize < inf


ignoreWeightsBelow: number = 0.0

Links with weights below this value will be ignored.

Range: 0.0 ≤ ignoreWeightsBelow < inf