neighbours

fun neighbours(node: T): List<T>

Retrieves a list of the neighboring nodes of the specified node.

NOTE: should be replaced with the forEachNeighbour function if performance is critical, to avoid copying overhead.

Return

A list of neighboring nodes connected to the specified node.

Parameters

node

The node whose neighbors are to be retrieved.

Throws

If the specified node is not found in the graph.