Skip to content

@graphty/graphty-element / extend / NodeScoreDefinition

Interface: NodeScoreDefinition<O> ​

Defined in: graphty-element/src/simple/types.ts:261

A score per node, computed one node at a time. Published as a node-metric result, field "value".

Extends ​

  • AlgorithmDefinitionBase<O>

Type Parameters ​

O ​

O extends OptionsShorthand

Properties ​

description? ​

readonly optional description?: string

Defined in: graphty-element/src/simple/types.ts:87

One sentence for pickers and the catalogue. Default: "".

Inherited from ​

AlgorithmDefinitionBase.description


direction? ​

readonly optional direction?: "directed" | "undirected"

Defined in: graphty-element/src/simple/types.ts:244

"undirected" (the default) ignores edge direction, and the directed accessors of the view throw.

Inherited from ​

AlgorithmDefinitionBase.direction


edge? ​

readonly optional edge?: undefined

Defined in: graphty-element/src/simple/types.ts:264


groups? ​

readonly optional groups?: undefined

Defined in: graphty-element/src/simple/types.ts:266


id ​

readonly id: string

Defined in: graphty-element/src/simple/types.ts:83

Permanent id: lower case, hyphenated, vendor-prefixed ("acme-hop-reach"). Kept unchanged when the extension graduates.

Inherited from ​

AlgorithmDefinitionBase.id


name? ​

readonly optional name?: string

Defined in: graphty-element/src/simple/types.ts:85

What pickers show. Default: the id in sentence case ("acme-hop-reach" reads "Acme hop reach").

Inherited from ​

AlgorithmDefinitionBase.name


node ​

readonly node: (node, context) => Score

Defined in: graphty-element/src/simple/types.ts:263

The score of one node; called once per node. Return the number itself, not a promise.

Parameters ​

node ​

NodeView

context ​

AlgorithmContext<OptionValuesOf<O>>

Returns ​

Score


nodes? ​

readonly optional nodes?: undefined

Defined in: graphty-element/src/simple/types.ts:265


options? ​

readonly optional options?: O

Defined in: graphty-element/src/simple/types.ts:89

The options a reader may set, in short form: { spacing: 2, weight: { type: "attribute", on: "edge" } }.

Inherited from ​

AlgorithmDefinitionBase.options


passes? ​

readonly optional passes?: keyof O & string

Defined in: graphty-element/src/simple/types.ts:251

For a whole-graph function that walks the graph repeatedly: the integer option that caps the passes.

Inherited from ​

AlgorithmDefinitionBase.passes


suggestedName? ​

readonly optional suggestedName?: (options) => SuggestedName | undefined

Defined in: graphty-element/src/simple/types.ts:257

Optional: the name of a run's result, from its option values. id becomes the path a style layer reads (results.<id>.value): lower-case letters, digits and underscores. label is what the layer list and legend show. Return undefined to use the algorithm id.

Parameters ​

options ​

OptionValuesOf<O>

Returns ​

SuggestedName | undefined

Inherited from ​

AlgorithmDefinitionBase.suggestedName


version? ​

readonly optional version?: string

Defined in: graphty-element/src/simple/types.ts:91

The extension's own semver version, recorded as provenance.

Inherited from ​

AlgorithmDefinitionBase.version


weights? ​

readonly optional weights?: object

Defined in: graphty-element/src/simple/types.ts:249

Optional: the edge "attribute" option that holds weights, and what they mean. Only what the run record says a weight meant; the weight it records is the one the run actually read.

meaning ​

readonly meaning: "strength" | "distance"

option ​

readonly option: keyof O & string

Inherited from ​

AlgorithmDefinitionBase.weights