@graphty/layout / index / LAYOUTS
Variable: LAYOUTS
constLAYOUTS:object
Defined in: catalog.ts:79
Every layout of @graphty/layout, keyed by name.
Type Declaration
arf
readonlyarf:object
arf.accelerator
readonlyaccelerator:null=null
arf.direction
readonlydirection:"any"="any"
arf.fn
readonlyfn: (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
dim values per node
arf.name
readonlyname:"arf"="arf"
arf.requiredOptions
readonlyrequiredOptions: readonly [] =[]
arf.requiresAccelerator
readonlyrequiresAccelerator:false=false
arf.simulation
readonlysimulation:null=null
arf.weights
readonlyweights:"never"="never"
bfs
readonlybfs:object
bfs.accelerator
readonlyaccelerator:null=null
bfs.direction
readonlydirection:"any"="any"
bfs.fn
readonlyfn: (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
the layout
Throws
when the graph is not connected
bfs.name
readonlyname:"bfs"="bfs"
bfs.requiredOptions
readonlyrequiredOptions: readonly [] =[]
bfs.requiresAccelerator
readonlyrequiresAccelerator:false=false
bfs.simulation
readonlysimulation:null=null
bfs.weights
readonlyweights:"never"="never"
bipartite
readonlybipartite:object
bipartite.accelerator
readonlyaccelerator:null=null
bipartite.direction
readonlydirection:"any"="any"
bipartite.fn
readonlyfn: (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?
scale is the distance of the farthest node from the centre; top the first line
Returns
the layout
bipartite.name
readonlyname:"bipartite"="bipartite"
bipartite.requiredOptions
readonlyrequiredOptions: readonly [] =[]
bipartite.requiresAccelerator
readonlyrequiresAccelerator:false=false
bipartite.simulation
readonlysimulation:null=null
bipartite.weights
readonlyweights:"never"="never"
circular
readonlycircular:object
circular.accelerator
readonlyaccelerator:null=null
circular.direction
readonlydirection:"any"="any"
circular.fn
readonlyfn: (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
the layout
circular.name
readonlyname:"circular"="circular"
circular.requiredOptions
readonlyrequiredOptions: readonly [] =[]
circular.requiresAccelerator
readonlyrequiresAccelerator:false=false
circular.simulation
readonlysimulation:null=null
circular.weights
readonlyweights:"never"="never"
forceAtlas2
readonlyforceAtlas2:object
forceAtlas2.accelerator
readonlyaccelerator:"forceAtlas2"="forceAtlas2"
forceAtlas2.direction
readonlydirection:"any"="any"
forceAtlas2.fn
readonlyfn: (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
dim values per node
forceAtlas2.name
readonlyname:"forceAtlas2"="forceAtlas2"
forceAtlas2.requiredOptions
readonlyrequiredOptions: readonly [] =[]
forceAtlas2.requiresAccelerator
readonlyrequiresAccelerator:false=false
forceAtlas2.simulation
readonlysimulation:"forceatlas2"="forceatlas2"
forceAtlas2.weights
readonlyweights:"on-request"="on-request"
fruchtermanReingold
readonlyfruchtermanReingold:object
fruchtermanReingold.accelerator
readonlyaccelerator:"fruchtermanReingold"="fruchtermanReingold"
fruchtermanReingold.direction
readonlydirection:"any"="any"
fruchtermanReingold.fn
readonlyfn: (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
dim values per node
fruchtermanReingold.name
readonlyname:"fruchtermanReingold"="fruchtermanReingold"
fruchtermanReingold.requiredOptions
readonlyrequiredOptions: readonly [] =[]
fruchtermanReingold.requiresAccelerator
readonlyrequiresAccelerator:false=false
fruchtermanReingold.simulation
readonlysimulation:"fruchtermanReingold"="fruchtermanReingold"
fruchtermanReingold.weights
readonlyweights:"never"="never"
grid
readonlygrid:object
grid.accelerator
readonlyaccelerator:null=null
grid.direction
readonlydirection:"any"="any"
grid.fn
readonlyfn: (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
the layout
grid.name
readonlyname:"grid"="grid"
grid.requiredOptions
readonlyrequiredOptions: readonly [] =[]
grid.requiresAccelerator
readonlyrequiresAccelerator:false=false
grid.simulation
readonlysimulation:null=null
grid.weights
readonlyweights:"never"="never"
kamadaKawai
readonlykamadaKawai:object
kamadaKawai.accelerator
readonlyaccelerator:null=null
kamadaKawai.direction
readonlydirection:"any"="any"
kamadaKawai.fn
readonlyfn: (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
dim values per node
kamadaKawai.name
readonlyname:"kamadaKawai"="kamadaKawai"
kamadaKawai.requiredOptions
readonlyrequiredOptions: readonly [] =[]
kamadaKawai.requiresAccelerator
readonlyrequiresAccelerator:false=false
kamadaKawai.simulation
readonlysimulation:null=null
kamadaKawai.weights
readonlyweights:"by-default"="by-default"
multipartite
readonlymultipartite:object
multipartite.accelerator
readonlyaccelerator:null=null
multipartite.direction
readonlydirection:"any"="any"
multipartite.fn
readonlyfn: (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
the layout
multipartite.name
readonlyname:"multipartite"="multipartite"
multipartite.requiredOptions
readonlyrequiredOptions: readonly ["subsets"]
multipartite.requiresAccelerator
readonlyrequiresAccelerator:false=false
multipartite.simulation
readonlysimulation:null=null
multipartite.weights
readonlyweights:"never"="never"
planar
readonlyplanar:object
planar.accelerator
readonlyaccelerator:null=null
planar.direction
readonlydirection:"any"="any"
planar.fn
readonlyfn: (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
the layout
Throws
"G is not planar." when the check rejects the graph
planar.name
readonlyname:"planar"="planar"
planar.requiredOptions
readonlyrequiredOptions: readonly [] =[]
planar.requiresAccelerator
readonlyrequiresAccelerator:false=false
planar.simulation
readonlysimulation:null=null
planar.weights
readonlyweights:"never"="never"
radial
readonlyradial:object
radial.accelerator
readonlyaccelerator:null=null
radial.direction
readonlydirection:"any"="any"
radial.fn
readonlyfn: (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
the layout
radial.name
readonlyname:"radial"="radial"
radial.requiredOptions
readonlyrequiredOptions: readonly [] =[]
radial.requiresAccelerator
readonlyrequiresAccelerator:false=false
radial.simulation
readonlysimulation:null=null
radial.weights
readonlyweights:"never"="never"
random
readonlyrandom:object
random.accelerator
readonlyaccelerator:null=null
random.direction
readonlydirection:"any"="any"
random.fn
readonlyfn: (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
the layout
random.name
readonlyname:"random"="random"
random.requiredOptions
readonlyrequiredOptions: readonly [] =[]
random.requiresAccelerator
readonlyrequiresAccelerator:false=false
random.simulation
readonlysimulation:null=null
random.weights
readonlyweights:"never"="never"
shell
readonlyshell:object
shell.accelerator
readonlyaccelerator:null=null
shell.direction
readonlydirection:"any"="any"
shell.fn
readonlyfn: (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
the layout
shell.name
readonlyname:"shell"="shell"
shell.requiredOptions
readonlyrequiredOptions: readonly [] =[]
shell.requiresAccelerator
readonlyrequiresAccelerator:false=false
shell.simulation
readonlysimulation:null=null
shell.weights
readonlyweights:"never"="never"
spectral
readonlyspectral:object
spectral.accelerator
readonlyaccelerator:null=null
spectral.direction
readonlydirection:"any"="any"
spectral.fn
readonlyfn: (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
the layout
spectral.name
readonlyname:"spectral"="spectral"
spectral.requiredOptions
readonlyrequiredOptions: readonly [] =[]
spectral.requiresAccelerator
readonlyrequiresAccelerator:false=false
spectral.simulation
readonlysimulation:null=null
spectral.weights
readonlyweights:"never"="never"
spiral
readonlyspiral:object
spiral.accelerator
readonlyaccelerator:null=null
spiral.direction
readonlydirection:"any"="any"
spiral.fn
readonlyfn: (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
the layout
spiral.name
readonlyname:"spiral"="spiral"
spiral.requiredOptions
readonlyrequiredOptions: readonly [] =[]
spiral.requiresAccelerator
readonlyrequiresAccelerator:false=false
spiral.simulation
readonlysimulation:null=null
spiral.weights
readonlyweights:"never"="never"
springElectrical
readonlyspringElectrical:object
springElectrical.accelerator
readonlyaccelerator:"springElectrical"="springElectrical"
springElectrical.direction
readonlydirection:"any"="any"
springElectrical.fn
readonlyfn:null=null
springElectrical.name
readonlyname:"springElectrical"="springElectrical"
springElectrical.requiredOptions
readonlyrequiredOptions: readonly [] =[]
springElectrical.requiresAccelerator
readonlyrequiresAccelerator:true=true
springElectrical.simulation
readonlysimulation:"spring-electrical"="spring-electrical"
springElectrical.weights
readonlyweights:"never"="never"
Example
import { LAYOUTS } from "@graphty/layout";
const oneShot = Object.values(LAYOUTS).filter((l) => l.fn !== null && l.requiredOptions.length === 0);