findParent

inline fun <ID : Any, Potential : Comparable<Potential>> Aggregate<ID>.findParent(potential: Field<ID, Potential>, comparator: Comparator<FieldEntry<ID, Potential>> = defaultComparator()): ID
inline fun <ID : Any, Potential : Comparable<Potential>> Aggregate<ID>.findParent(potential: Potential, comparator: Comparator<FieldEntry<ID, Potential>> = defaultComparator()): ID

Find the best neighbor of the current device along a potential field, selecting it with the provided comparator function by returning the minimum.

By default, the neighbor with the lowest potential is selected.

If there are no neighbors, or the local device is the best one, its ID is returned.