// Affinity propagation, which picks exemplars by message passing and so needs no target cluster count
eles.affinityPropagation(options?: AffinityPropagationOptions): AlgoRun<Collection<NodeData, EdgeData, NodeData>[]>Affinity propagation, which picks exemplars by message passing and so needs no target cluster count.
Async: returns a promise, and executor ('cpu' | 'gpu' | 'auto', default 'auto'; 'workers' runs the reference on one pool worker) picks where the message passing runs; 'cpu' is the reproducible reference.
| Name | Description |
|---|---|
options: AffinityPropagationOptions? |
|
Fields of options
| Name | Description |
|---|---|
distance: DistanceMetric? | |
preference: AffinityPreference? | |
damping: number? | |
maxIterations: number? | |
minIterations: number? | |
attributes: AffinityAttributeFn[]? | |
executor: AlgoExecutor? | where the run executes; see |
AlgoRun<Collection<NodeData, EdgeData, NodeData>[]>a promise of one collection per cluster — with cancel() on it: a pending run rejects with CancelledError, a 'cpu' run has already completed
Example
const run = cy.nodes().affinityPropagation({ damping: 0.5, preference: 0, attributes: [node => node.data('score')], executor: 'cpu' });const result = await run;console.log(result.reduce((sum, cluster) => sum + cluster.length, 0)); // 3if executor is invalid; rejects if executor: 'gpu' is unavailable, or if damping/preference are invalid
Also spelled eles.ap.