Skip to content

@graphty/layout / index / LAYOUTS

Variable: LAYOUTS ​

const LAYOUTS: object

Defined in: catalog.ts:79

Every layout of @graphty/layout, keyed by name.

Type Declaration ​

arf ​

readonly arf: object

arf.accelerator ​

readonly accelerator: null = null

arf.direction ​

readonly direction: "any" = "any"

arf.fn ​

readonly fn: (g, options) => LayoutResult = arf

The attractive and repulsive forces layout (networkx's arf_layout). Without scale or center its result is not rescaled: the forces settle at their own scale, which scaling sets. With either, the farthest node ends scale from center.

Parameters ​
g ​

GraphSnapshot

the graph; a directed snapshot is laid out as its undirected copy

options? ​

ArfOptions = {}

the options

Returns ​

LayoutResult

dim values per node

arf.name ​

readonly name: "arf" = "arf"

arf.requiredOptions ​

readonly requiredOptions: readonly [] = []

arf.requiresAccelerator ​

readonly requiresAccelerator: false = false

arf.simulation ​

readonly simulation: null = null

arf.weights ​

readonly weights: "never" = "never"

bfs ​

readonly bfs: object

bfs.accelerator ​

readonly accelerator: null = null

bfs.direction ​

readonly direction: "any" = "any"

bfs.fn ​

readonly fn: (s, options) => LayoutResult = bfs

Nodes in layers by hop distance from start, laid out as the multipartite layout lays out its layers: with vertical alignment layer k is a column, its nodes in the order the search reached them. In 3D the layout lies in the plane of the centre's z.

Parameters ​
s ​

GraphSnapshot

the snapshot; a directed one is read as its undirected derived graph

options? ​

BfsLayoutOptions = {}

scale is the distance of the farthest node from the centre; start the first layer

Returns ​

LayoutResult

the layout

Throws ​

when the graph is not connected

bfs.name ​

readonly name: "bfs" = "bfs"

bfs.requiredOptions ​

readonly requiredOptions: readonly [] = []

bfs.requiresAccelerator ​

readonly requiresAccelerator: false = false

bfs.simulation ​

readonly simulation: null = null

bfs.weights ​

readonly weights: "never" = "never"

bipartite ​

readonly bipartite: object

bipartite.accelerator ​

readonly accelerator: null = null

bipartite.direction ​

readonly direction: "any" = "any"

bipartite.fn ​

readonly fn: (s, options) => LayoutResult = bipartite

Nodes in two straight lines: with vertical alignment the top nodes form the left column and the rest the right, each in node-index order. In 3D the layout lies in the plane of the centre's z.

Parameters ​
s ​

GraphSnapshot

the snapshot; only its node count and the named column are read

options? ​

BipartiteLayoutOptions = {}

scale is the distance of the farthest node from the centre; top the first line

Returns ​

LayoutResult

the layout

bipartite.name ​

readonly name: "bipartite" = "bipartite"

bipartite.requiredOptions ​

readonly requiredOptions: readonly [] = []

bipartite.requiresAccelerator ​

readonly requiresAccelerator: false = false

bipartite.simulation ​

readonly simulation: null = null

bipartite.weights ​

readonly weights: "never" = "never"

circular ​

readonly circular: object

circular.accelerator ​

readonly accelerator: null = null

circular.direction ​

readonly direction: "any" = "any"

circular.fn ​

readonly fn: (s, options) => LayoutResult = circular

Nodes on a circle (2D) or spread over a sphere by the Fibonacci spiral (3D), in node-index order: node i of a circle is at angle 2 * PI * i / n.

Parameters ​
s ​

GraphSnapshot

the snapshot; only its node count is read

options? ​

CommonLayoutOptions = {}

scale is the radius

Returns ​

LayoutResult

the layout

circular.name ​

readonly name: "circular" = "circular"

circular.requiredOptions ​

readonly requiredOptions: readonly [] = []

circular.requiresAccelerator ​

readonly requiresAccelerator: false = false

circular.simulation ​

readonly simulation: null = null

circular.weights ​

readonly weights: "never" = "never"

forceAtlas2 ​

readonly forceAtlas2: object

forceAtlas2.accelerator ​

readonly accelerator: "forceAtlas2" = "forceAtlas2"

forceAtlas2.direction ​

readonly direction: "any" = "any"

forceAtlas2.fn ​

readonly fn: (g, options) => LayoutResult = forceAtlas2

ForceAtlas2 run for maxIter iterations (default 100; a fractional count runs its ceiling, and 0, a negative or a non-finite count runs none), then rescaled to scale (default 1) about center (default the origin). nodeMass and nodeSize take a Float32Array, a node column name or an id-keyed record; with none, a role-mass node column, else outDegree + 1. weight is true for the snapshot's weights or an edge column name.

Parameters ​
g ​

GraphSnapshot

the graph; a directed snapshot is laid out as its undirected copy

options? ​

IndexedForceAtlas2Options = {}

the options

Returns ​

LayoutResult

dim values per node

forceAtlas2.name ​

readonly name: "forceAtlas2" = "forceAtlas2"

forceAtlas2.requiredOptions ​

readonly requiredOptions: readonly [] = []

forceAtlas2.requiresAccelerator ​

readonly requiresAccelerator: false = false

forceAtlas2.simulation ​

readonly simulation: "forceatlas2" = "forceatlas2"

forceAtlas2.weights ​

readonly weights: "on-request" = "on-request"

fruchtermanReingold ​

readonly fruchtermanReingold: object

fruchtermanReingold.accelerator ​

readonly accelerator: "fruchtermanReingold" = "fruchtermanReingold"

fruchtermanReingold.direction ​

readonly direction: "any" = "any"

fruchtermanReingold.fn ​

readonly fn: (g, options) => LayoutResult = fruchtermanReingold

Fruchterman-Reingold run for iterations iterations (default 50; a fractional count runs its ceiling, and 0, a negative or a non-finite count runs none) with the linear cooling schedule. Each NaN component of pos is drawn from the seed in [0, 1), whatever the other rows hold. Without pinned nodes the result is rescaled to scale about center; with a fixed option or a role-fixed bool column it is left in the units of pos, so a pinned node keeps exactly the coordinates it was given.

Parameters ​
g ​

GraphSnapshot

the graph; a directed snapshot is laid out as its undirected copy

options? ​

IndexedFruchtermanReingoldOptions = {}

the options

Returns ​

LayoutResult

dim values per node

fruchtermanReingold.name ​

readonly name: "fruchtermanReingold" = "fruchtermanReingold"

fruchtermanReingold.requiredOptions ​

readonly requiredOptions: readonly [] = []

fruchtermanReingold.requiresAccelerator ​

readonly requiresAccelerator: false = false

fruchtermanReingold.simulation ​

readonly simulation: "fruchtermanReingold" = "fruchtermanReingold"

fruchtermanReingold.weights ​

readonly weights: "never" = "never"

grid ​

readonly grid: object

grid.accelerator ​

readonly accelerator: null = null

grid.direction ​

readonly direction: "any" = "any"

grid.fn ​

readonly fn: (s, options) => LayoutResult = grid

Nodes on a regular lattice, row by row in node-index order. In 3D the lattice lies in the plane of the centre's z.

Parameters ​
s ​

GraphSnapshot

the snapshot; only its node count is read

options? ​

GridLayoutOptions = {}

scale is half the length of the lattice's longer side

Returns ​

LayoutResult

the layout

grid.name ​

readonly name: "grid" = "grid"

grid.requiredOptions ​

readonly requiredOptions: readonly [] = []

grid.requiresAccelerator ​

readonly requiresAccelerator: false = false

grid.simulation ​

readonly simulation: null = null

grid.weights ​

readonly weights: "never" = "never"

kamadaKawai ​

readonly kamadaKawai: object

kamadaKawai.accelerator ​

readonly accelerator: null = null

kamadaKawai.direction ​

readonly direction: "any" = "any"

kamadaKawai.fn ​

readonly fn: (g, options) => LayoutResult = kamadaKawai

Kamada-Kawai: positions whose distances best match the ideal distances (networkx's kamada_kawai_layout), rescaled to scale (default 1) about center (default the origin). Weights are distances, as in networkx.

Parameters ​
g ​

GraphSnapshot

the graph; a directed snapshot is laid out as its undirected copy

options? ​

KamadaKawaiOptions = {}

the options

Returns ​

LayoutResult

dim values per node

kamadaKawai.name ​

readonly name: "kamadaKawai" = "kamadaKawai"

kamadaKawai.requiredOptions ​

readonly requiredOptions: readonly [] = []

kamadaKawai.requiresAccelerator ​

readonly requiresAccelerator: false = false

kamadaKawai.simulation ​

readonly simulation: null = null

kamadaKawai.weights ​

readonly weights: "by-default" = "by-default"

multipartite ​

readonly multipartite: object

multipartite.accelerator ​

readonly accelerator: null = null

multipartite.direction ​

readonly direction: "any" = "any"

multipartite.fn ​

readonly fn: (s, options) => LayoutResult = multipartite

Nodes in straight lines, one line per layer: with vertical alignment layer k is a column left of layer k + 1, its nodes evenly spaced top to bottom in the order listed. In 3D the layout lies in the plane of the centre's z.

Parameters ​
s ​

GraphSnapshot

the snapshot; only its node count and the named column are read

options? ​

MultipartiteLayoutOptions = {}

scale is the distance of the farthest node from the centre; subsets the layers

Returns ​

LayoutResult

the layout

multipartite.name ​

readonly name: "multipartite" = "multipartite"

multipartite.requiredOptions ​

readonly requiredOptions: readonly ["subsets"]

multipartite.requiresAccelerator ​

readonly requiresAccelerator: false = false

multipartite.simulation ​

readonly simulation: null = null

multipartite.weights ​

readonly weights: "never" = "never"

planar ​

readonly planar: object

planar.accelerator ​

readonly accelerator: null = null

planar.direction ​

readonly direction: "any" = "any"

planar.fn ​

readonly fn: (s, options) => LayoutResult = planar

Nodes placed without edge crossings for the graphs the check accepts (see planarRows): a cycle of the graph on a circle, the other nodes inside it near their neighbours. In 3D the layout lies in the plane of the centre's z.

Parameters ​
s ​

GraphSnapshot

the snapshot; a directed one is read as its undirected derived graph

options? ​

CommonLayoutOptions = {}

scale is the distance of the farthest node from the centre; seed fixes the jitter

Returns ​

LayoutResult

the layout

Throws ​

"G is not planar." when the check rejects the graph

planar.name ​

readonly name: "planar" = "planar"

planar.requiredOptions ​

readonly requiredOptions: readonly [] = []

planar.requiresAccelerator ​

readonly requiresAccelerator: false = false

planar.simulation ​

readonly simulation: null = null

planar.weights ​

readonly weights: "never" = "never"

radial ​

readonly radial: object

radial.accelerator ​

readonly accelerator: null = null

radial.direction ​

readonly direction: "any" = "any"

radial.fn ​

readonly fn: (s, options) => LayoutResult = radial

Nodes on concentric rings by hop distance from a root: the root on the centre, ring k at radius k * scale / (ringCount - 1), nodes the root cannot reach on one extra outer ring. Edges are taken as undirected. In 3D the rings lie in the plane of the centre's z.

Parameters ​
s ​

GraphSnapshot

the snapshot; a directed one is read as its undirected derived graph

options? ​

RadialLayoutOptions = {}

scale is the radius of the outermost ring; root the centre node

Returns ​

LayoutResult

the layout

radial.name ​

readonly name: "radial" = "radial"

radial.requiredOptions ​

readonly requiredOptions: readonly [] = []

radial.requiresAccelerator ​

readonly requiresAccelerator: false = false

radial.simulation ​

readonly simulation: null = null

radial.weights ​

readonly weights: "never" = "never"

random ​

readonly random: object

random.accelerator ​

readonly accelerator: null = null

random.direction ​

readonly direction: "any" = "any"

random.fn ​

readonly fn: (s, options) => LayoutResult = random

Nodes uniformly at random in the cell [center, center + scale) of every axis (the unit cell at the origin by default). The same seed gives the same layout.

Parameters ​
s ​

GraphSnapshot

the snapshot; only its node count is read

options? ​

CommonLayoutOptions = {}

scale is the side of the cell; seed the generator seed

Returns ​

LayoutResult

the layout

random.name ​

readonly name: "random" = "random"

random.requiredOptions ​

readonly requiredOptions: readonly [] = []

random.requiresAccelerator ​

readonly requiresAccelerator: false = false

random.simulation ​

readonly simulation: null = null

random.weights ​

readonly weights: "never" = "never"

shell ​

readonly shell: object

shell.accelerator ​

readonly accelerator: null = null

shell.direction ​

readonly direction: "any" = "any"

shell.fn ​

readonly fn: (s, options) => LayoutResult = shell

Nodes on concentric circles, one circle per shell, each circle's nodes evenly spaced in the order listed. In 3D the circles lie in the plane of the centre's z.

Parameters ​
s ​

GraphSnapshot

the snapshot

options? ​

ShellLayoutOptions = {}

scale / m is the radius step between the m shells; nlist the shells

Returns ​

LayoutResult

the layout

shell.name ​

readonly name: "shell" = "shell"

shell.requiredOptions ​

readonly requiredOptions: readonly [] = []

shell.requiresAccelerator ​

readonly requiresAccelerator: false = false

shell.simulation ​

readonly simulation: null = null

shell.weights ​

readonly weights: "never" = "never"

spectral ​

readonly spectral: object

spectral.accelerator ​

readonly accelerator: null = null

spectral.direction ​

readonly direction: "any" = "any"

spectral.fn ​

readonly fn: (s, options) => LayoutResult = spectral

Nodes placed by the Laplacian's eigenvectors as power iteration finds them (see spectralRows), one component per dimension, rescaled so the farthest node is scale from the centre.

Parameters ​
s ​

GraphSnapshot

the snapshot; a directed one is read as its undirected derived graph

options? ​

CommonLayoutOptions = {}

seed fixes the start vectors

Returns ​

LayoutResult

the layout

spectral.name ​

readonly name: "spectral" = "spectral"

spectral.requiredOptions ​

readonly requiredOptions: readonly [] = []

spectral.requiresAccelerator ​

readonly requiresAccelerator: false = false

spectral.simulation ​

readonly simulation: null = null

spectral.weights ​

readonly weights: "never" = "never"

spiral ​

readonly spiral: object

spiral.accelerator ​

readonly accelerator: null = null

spiral.direction ​

readonly direction: "any" = "any"

spiral.fn ​

readonly fn: (s, options) => LayoutResult = spiral

Nodes along an Archimedean spiral from the centre outwards, in node-index order. In 3D the spiral lies in the plane of the centre's z.

Parameters ​
s ​

GraphSnapshot

the snapshot; only its node count is read

options? ​

SpiralLayoutOptions = {}

scale is the distance of the farthest node from the centre

Returns ​

LayoutResult

the layout

spiral.name ​

readonly name: "spiral" = "spiral"

spiral.requiredOptions ​

readonly requiredOptions: readonly [] = []

spiral.requiresAccelerator ​

readonly requiresAccelerator: false = false

spiral.simulation ​

readonly simulation: null = null

spiral.weights ​

readonly weights: "never" = "never"

springElectrical ​

readonly springElectrical: object

springElectrical.accelerator ​

readonly accelerator: "springElectrical" = "springElectrical"

springElectrical.direction ​

readonly direction: "any" = "any"

springElectrical.fn ​

readonly fn: null = null

springElectrical.name ​

readonly name: "springElectrical" = "springElectrical"

springElectrical.requiredOptions ​

readonly requiredOptions: readonly [] = []

springElectrical.requiresAccelerator ​

readonly requiresAccelerator: true = true

springElectrical.simulation ​

readonly simulation: "spring-electrical" = "spring-electrical"

springElectrical.weights ​

readonly weights: "never" = "never"

Example ​

ts
import { LAYOUTS } from "@graphty/layout";

const oneShot = Object.values(LAYOUTS).filter((l) => l.fn !== null && l.requiredOptions.length === 0);