addEdge

open override fun addEdge(node1: Tile, node2: Tile, weight: Double = 1.0)

Adds a directed edge from node1 to node2. Tiles are matched by their (x, y) coordinates, so data is ignored.

NOTE: For performance, the tiles are not validated. Both must be within grid bounds and not deleted, otherwise the behavior is undefined.

Parameters

node1

The starting tile of the edge.

node2

The ending tile of the edge.

weight

The weight of the edge, for example used to calculate distances with shortestPathsFrom. Defaults to 1.0.

Throws

If a tile is outside the grid or has been deleted.