Skip to content

@graphty/graphty-element / extend / AlgorithmRunContext

Interface: AlgorithmRunContext ​

Defined in: graphty-element/src/algorithms/results/types.ts:114

What the element gives an algorithm while it runs.

Four members: a signal that says stop, a way to say how far along the work is, a way to hand the frame back so a long computation does not lock the screen, and the graph the run computes over. An algorithm that reports nothing and never yields is indistinguishable, to a reader watching a large graph, from one that has hung.

Extends ​

  • RunControls

Properties ​

signal ​

readonly signal: AbortSignal

Defined in: graphty-element/src/algorithms/results/types.ts:138

Aborted when the run is cancelled. Throw from it; never swallow it.

Inherited from ​

RunControls.signal

Methods ​

input() ​

input(orientation, options?): ScopedInput

Defined in: graphty-element/src/algorithms/results/types.ts:129

The graph this run computes over, in one orientation.

A class declaring static scopeInput = "subgraph" is handed its run's scope: subgraph() is the compact snapshot of the scope's nodes and edges, and nodes/edges are its masks over the full graph. Every other class is handed the whole graph, and the element keeps only the scope's values of what it publishes, with the caveat "Computed on the whole graph; values kept for the scope only." Publish by element id either way; row numbers of a subgraph are not the graph's.

Parameters ​

orientation ​

"declared" | "undirected"

"declared", the graph as loaded, or "undirected", with a reciprocal pair collapsed into one edge.

options? ​

ScopedInputOptions

How parallel edges merge in subgraph(): "sum" by default.

Returns ​

ScopedInput

The input.


report() ​

report(progress): void

Defined in: graphty-element/src/algorithms/results/types.ts:143

Say how far along the work is.

Parameters ​

progress ​

RunProgressReport

What changed.

Returns ​

void

Inherited from ​

RunControls.report


yieldNow() ​

yieldNow(): Promise<void>

Defined in: graphty-element/src/algorithms/results/types.ts:148

Hand the frame back before starting the next chunk.

Returns ​

Promise<void>

A promise that settles when the work may continue.

Inherited from ​

RunControls.yieldNow