Skip to content

@graphty/graphty-element / index / defineAlgorithm

Function: defineAlgorithm() ​

defineAlgorithm<O>(definition, options?): void

Defined in: graphty-element/src/simple/defineAlgorithm.ts:536

Register an algorithm from a plain definition object.

Type Parameters ​

O ​

O extends Readonly<Record<string, OptionShorthand>> = NoOptions

Parameters ​

definition ​

AlgorithmDefinition<O>

The id, the options in short form and ONE of node, edge, nodes or groups.

options? ​

RegisterOptions

Whether a different algorithm under an id already taken throws instead of replacing it.

Returns ​

void

Throws ​

A GraphtyError E_BAD_COMMAND for a malformed definition, before anything is registered.