@graphty/graphty-element / extend / AlgorithmContext
Interface: AlgorithmContext<V> ​
Defined in: graphty-element/src/simple/types.ts:220
What an algorithm's function receives beside the node, edge or graph.
Type Parameters ​
V ​
V
Properties ​
graph ​
readonlygraph:GraphView
Defined in: graphty-element/src/simple/types.ts:224
The whole graph.
options ​
readonlyoptions:V
Defined in: graphty-element/src/simple/types.ts:222
The option values, checked and with their defaults filled in.
signal ​
readonlysignal:AbortSignal
Defined in: graphty-element/src/simple/types.ts:226
Aborted when the run is cancelled. Only a whole-graph function needs it.
Methods ​
converged() ​
converged(
converged,iterations):void
Defined in: graphty-element/src/simple/types.ts:236
Record how an iterative method ended; a run that did not converge says so in its caveats.
Parameters ​
converged ​
boolean
iterations ​
number
Returns ​
void
note() ​
note(
text):void
Defined in: graphty-element/src/simple/types.ts:234
A sentence for the run record's caveats ("Dangling mass returns to the seeds.").
Parameters ​
text ​
string
Returns ​
void
progress() ​
progress(
fraction):Promise<void>
Defined in: graphty-element/src/simple/types.ts:232
Only a whole-graph function needs it: the share of the work done, 0 to 1. AWAIT it inside a loop: the promise lets the page draw a frame, and rejects with the abort reason when the run was cancelled.
Parameters ​
fraction ​
number
Returns ​
Promise<void>