multiIntGradientCast

inline fun <ID : Any, Value> Aggregate<ID>.multiIntGradientCast(sources: Iterable<ID>, local: Value, metric: Field<ID, Int> = hops(), maxDiameter: Int = Int.MAX_VALUE, noinline accumulateData: (fromSource: Int, toNeighbor: Int, data: Value) -> Value = { _, _, data -> data }): Map<ID, Value>

For each ID in sources, propagates data from that source using a fast-repair integer gradient, and collects the results in a map from source ID to propagated value.

Delegates to intGradientCast, which uses a default distance of 0 to Int.MAX_VALUE, the hop-count metric (hops()), and non-overflowing addition for distance accumulation. If a source is unreachable or there are no neighbors, the local value is used.

Return

A Map<ID, Value> mapping each source ID to its propagated value at this device.

Parameters

ID

The type used for device identifiers.

Value

The type of data being propagated.

sources

Collection of device IDs to use as sources.

local

The local data value or default if a source path is not found.

metric

A Field<ID, Int> providing the hop-count metric to each neighbor. Defaults to hops().

maxDiameter

Maximum allowed hops before discarding a path. Defaults to Int.MAX_VALUE.

accumulateData

Function to update neighbor data on each hop. Receives the neighbor’s distance from the source, the hop increment (always 1), and the neighbor’s data. Defaults to the identity function.

See also