@graphty/graphty-element / index / AlgorithmManager
Class: AlgorithmManager ​
Defined in: graphty-element/src/managers/AlgorithmManager.ts:108
Manages algorithm execution and coordination Handles running algorithms from templates and individual algorithm execution
Implements ​
Constructors ​
Constructor ​
new AlgorithmManager(
eventManager,graph):AlgorithmManager
Defined in: graphty-element/src/managers/AlgorithmManager.ts:114
Creates an instance of AlgorithmManager
Parameters ​
eventManager ​
Event manager for emitting algorithm events
graph ​
Graph instance to run algorithms on
Returns ​
AlgorithmManager
Methods ​
dispose() ​
dispose():
void
Defined in: graphty-element/src/managers/AlgorithmManager.ts:131
Disposes of the algorithm manager and cleans up resources
Returns ​
void
Implementation of ​
execute() ​
execute(
context,descriptor?):Promise<RunOutcome<RunResult>>
Defined in: graphty-element/src/managers/AlgorithmManager.ts:158
Run one algorithm on behalf of the session's run machinery.
This is the seam that keeps the session free of the renderer. Every algorithm this package ships is constructed from a Graph and reads the graph through its data manager, so the session -- which must resolve in Node with no Babylon.js, Lit or DOM anywhere in its import graph -- cannot build one. It is handed this function instead, and what comes back is a plain result object.
What it does NOT do is write algorithmResults. The algorithm's own entry point publishes the result and projects the 1.10 view from it, in the one place that projection lives.
The catalogue entry arrives as an argument rather than being looked up here, because the run machinery has already resolved it -- that is what validated the parameters -- and looking it up a second time is how two parts of one package come to disagree about what an algorithm is.
Parameters ​
context ​
The run id, the algorithm, its parameters, the signal and the progress channel.
descriptor? ​
What the catalogue says about this algorithm, or undefined when the catalogue carries no entry for it.
Returns ​
Promise<RunOutcome<RunResult>>
What the run produced.
Throws ​
A GraphtyError when nothing registers the key, or whatever the work threw.
getAvailableAlgorithms() ​
getAvailableAlgorithms():
string[]
Defined in: graphty-element/src/managers/AlgorithmManager.ts:415
Get list of available algorithms TODO: This depends on the Algorithm registry implementation
Returns ​
string[]
Array of available algorithm names
hasAlgorithm() ​
hasAlgorithm(
namespace,type):boolean
Defined in: graphty-element/src/managers/AlgorithmManager.ts:401
Check if an algorithm exists
Parameters ​
namespace ​
string
Algorithm namespace
type ​
string
Algorithm type
Returns ​
boolean
True if the algorithm exists, false otherwise
init() ​
init():
Promise<void>
Defined in: graphty-element/src/managers/AlgorithmManager.ts:123
Initializes the algorithm manager
Returns ​
Promise<void>
Promise that resolves when initialization is complete
Implementation of ​
runAlgorithm() ​
runAlgorithm(
namespace,type,algorithmOptions?):Promise<void>
Defined in: graphty-element/src/managers/AlgorithmManager.ts:292
Run a specific algorithm by its 1.10 registry address, as one undoable step.
This is the path a PLUGIN algorithm takes. A plugin registers itself under a namespace:type and publishes no catalogue descriptor, so it cannot be started by key and the run machinery -- which agrees with the catalogue rather than restating it -- has nothing to agree with. Everything this package ships goes through AlgorithmManager.execute instead, reached from graph.run and session.runs.start.
It dispatches algo.legacy, which takes its turn on the queue, constructs the plugin with a facade of the graph and runs it: what it writes to node and edge records and graphResults, and every door it calls on the graph, are one step.
Parameters ​
namespace ​
string
Algorithm namespace (e.g., "graphty")
type ​
string
Algorithm type (e.g., "dijkstra")
algorithmOptions? ​
AlgorithmSpecificOptions
Optional algorithm-specific options (source, target, etc.)
Returns ​
Promise<void>
runAlgorithmsFromTemplate() ​
runAlgorithmsFromTemplate(
algorithms):Promise<void>
Defined in: graphty-element/src/managers/AlgorithmManager.ts:235
Run algorithms specified in the template configuration, as one undoable step.
Parameters ​
algorithms ​
string[]
Array of algorithm names in "namespace:type" format
Returns ​
Promise<void>