@graphty/graphty-element / extend / RegisteredAlgorithm
Interface: RegisteredAlgorithm ​
Defined in: graphty-element/src/catalog/registry.ts:51
A registered algorithm: what the catalogue publishes about it, and where its class lives.
The registry address is kept beside the descriptor rather than parsed back out of the key, because the two are independent. A plugin's catalogue key is what a consumer types and what a result path is built from; its namespace and type are what Algorithm.register filed the class under. Making the key carry the address would force every plugin to name itself twice in the same way and would break the moment one did not.
Properties ​
cost? ​
readonlyoptionalcost?: (n,m) =>number
Defined in: graphty-element/src/catalog/registry.ts:66
A cost model in seconds over a graph of n nodes and m edges, read from static cost.
HERE RATHER THAN ON THE DESCRIPTOR, because a function is not plain JSON and the composed catalogue has to survive JSON.stringify and a postMessage. Keeping the model beside the class reference makes that true by type rather than by the discipline of a test, and a plugin still supplies real arithmetic for the estimator to use.
Parameters ​
n ​
number
m ​
number
Returns ​
number
costUnits? ​
readonlyoptionalcostUnits?: (n,m,options) =>number
Defined in: graphty-element/src/catalog/registry.ts:74
A cost model in work units of the descriptor's cost class, read from static costUnits.
The estimator divides it by this device's rate for that class, so calibration scales it. Wins over cost when both are present. options are the run's option values, the declared defaults filled in.
Parameters ​
n ​
number
m ​
number
options ​
Readonly<Record<string, unknown>>
Returns ​
number
descriptor ​
readonlydescriptor:AlgorithmDescriptor
Defined in: graphty-element/src/catalog/registry.ts:53
What the catalogue publishes about it.
namespace ​
readonlynamespace:string
Defined in: graphty-element/src/catalog/registry.ts:55
The namespace the class is registered under.
suggestedName? ​
readonlyoptionalsuggestedName?: (options) =>SuggestedName|undefined
Defined in: graphty-element/src/catalog/registry.ts:87
The name a run's result is given, from the run's option values, read from static suggestedName. Undefined, or absent, names the result after the algorithm key.
Parameters ​
options ​
Readonly<Record<string, unknown>>
Returns ​
SuggestedName | undefined
type ​
readonlytype:string
Defined in: graphty-element/src/catalog/registry.ts:57
The type the class is registered under.
version? ​
readonlyoptionalversion?:string
Defined in: graphty-element/src/catalog/registry.ts:82
The plugin's own version, read from static version.
A saved run records the versions of the code that produced its numbers, and until this existed a run of a third party's algorithm recorded nothing identifying it -- which is the field's whole purpose.