Skip to content

Layout network

fast step  network

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


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

Step signature
    targets: list[number],
    *weights: list[number], 
        "param": value
) -> (x: column, y: column)

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.


For a weighted layout provide both input columns, e.g.

Example call (in recipe editor)
layout_network(ds.link_targets, ds.link_weights, {scalingRatio: 0.8, linLogMode: false}) -> (ds.x, ds.y)


targets: column:list[number]

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

*weights: column:list[number]


x: column

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

y: column

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


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