Skip to content

@graphty/graphty-element / layout/LayoutEngine / LayoutEngine

Abstract Class: LayoutEngine

Defined in: src/layout/LayoutEngine.ts:36

Base class for all layout engines

Extended by

Constructors

Constructor

new LayoutEngine(): LayoutEngine

Returns

LayoutEngine

Properties

config?

optional config: Record<string, unknown>

Defined in: src/layout/LayoutEngine.ts:39


maxDimensions

static maxDimensions: number

Defined in: src/layout/LayoutEngine.ts:38


type

static type: string

Defined in: src/layout/LayoutEngine.ts:37


zodOptionsSchema?

static optional zodOptionsSchema: OptionsSchema

Defined in: src/layout/LayoutEngine.ts:47

NEW: Zod-based options schema for unified validation and UI metadata

Subclasses should override this to define their configurable options using the new Zod-based schema system.

Accessors

edges

Get Signature

get abstract edges(): Iterable<Edge>

Defined in: src/layout/LayoutEngine.ts:62

Returns

Iterable<Edge>


isSettled

Get Signature

get abstract isSettled(): boolean

Defined in: src/layout/LayoutEngine.ts:63

Returns

boolean


nodes

Get Signature

get abstract nodes(): Iterable<Node>

Defined in: src/layout/LayoutEngine.ts:61

Returns

Iterable<Node>


type

Get Signature

get type(): string

Defined in: src/layout/LayoutEngine.ts:89

Get the type identifier for this layout engine

Returns

string

The layout engine type string

Methods

addEdge()

abstract addEdge(e): void

Defined in: src/layout/LayoutEngine.ts:52

Parameters

e

Edge

Returns

void


addEdges()

addEdges(edges): void

Defined in: src/layout/LayoutEngine.ts:79

Add multiple edges to the layout engine

Parameters

edges

Edge[]

Array of edges to add

Returns

void


addNode()

abstract addNode(n): void

Defined in: src/layout/LayoutEngine.ts:51

Parameters

n

Node

Returns

void


addNodes()

addNodes(nodes): void

Defined in: src/layout/LayoutEngine.ts:69

Add multiple nodes to the layout engine

Parameters

nodes

Node[]

Array of nodes to add

Returns

void


get()

static get(type, opts): LayoutEngine | null

Defined in: src/layout/LayoutEngine.ts:111

Get a layout engine instance by type

Parameters

type

string

The layout engine type identifier

opts

object = {}

Configuration options for the layout engine

Returns

LayoutEngine | null

A new layout engine instance or null if type not found


getClass()

static getClass(type): LayoutEngineClass & LayoutEngineStatics | null

Defined in: src/layout/LayoutEngine.ts:180

Get a layout class by type

Parameters

type

string

The layout engine type identifier

Returns

LayoutEngineClass & LayoutEngineStatics | null

The layout engine class or null if not found


getEdgePosition()

abstract getEdgePosition(e): EdgePosition

Defined in: src/layout/LayoutEngine.ts:55

Parameters

e

Edge

Returns

EdgePosition


getNodePosition()

abstract getNodePosition(n): Position

Defined in: src/layout/LayoutEngine.ts:53

Parameters

n

Node

Returns

Position


getOptionsForDimension()

static getOptionsForDimension(dimension): object | null

Defined in: src/layout/LayoutEngine.ts:125

Get dimension-specific options for this layout

Parameters

dimension

The desired dimension (2 or 3)

2 | 3

Returns

object | null

Options object for the dimension or null if unsupported


getOptionsForDimensionByType()

static getOptionsForDimensionByType(type, dimension): object | null

Defined in: src/layout/LayoutEngine.ts:142

Get dimension-specific options for a layout by type

Parameters

type

string

The layout engine type identifier

dimension

The desired dimension (2 or 3)

2 | 3

Returns

object | null

Options object for the dimension or null if type not found or unsupported


getRegisteredTypes()

static getRegisteredTypes(): string[]

Defined in: src/layout/LayoutEngine.ts:171

Get a list of all registered layout types

Returns

string[]

Array of registered layout type identifiers


getZodOptionsSchema()

static getZodOptionsSchema(): OptionsSchema

Defined in: src/layout/LayoutEngine.ts:155

Get the Zod-based options schema for this layout

Returns

OptionsSchema

The options schema, or an empty object if no schema defined


hasZodOptions()

static hasZodOptions(): boolean

Defined in: src/layout/LayoutEngine.ts:163

Check if this layout has a Zod-based options schema

Returns

boolean

true if the layout has options defined


init()

abstract init(): Promise<void>

Defined in: src/layout/LayoutEngine.ts:50

Returns

Promise<void>


pin()

abstract pin(n): void

Defined in: src/layout/LayoutEngine.ts:58

Parameters

n

Node

Returns

void


register()

static register<T>(cls): T

Defined in: src/layout/LayoutEngine.ts:98

Register a layout engine class in the global registry

Type Parameters

T

T extends LayoutEngineClass

Parameters

cls

T

The layout engine class to register

Returns

T

The registered class for chaining


setNodePosition()

abstract setNodePosition(n, p): void

Defined in: src/layout/LayoutEngine.ts:54

Parameters

n

Node

p

Position

Returns

void


step()

abstract step(): void

Defined in: src/layout/LayoutEngine.ts:57

Returns

void


unpin()

abstract unpin(n): void

Defined in: src/layout/LayoutEngine.ts:59

Parameters

n

Node

Returns

void