addEdge

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

Adds a directed edge from node1 to node2.

NOTE: For performance, the nodes are not validated. Both must be in 0 until size, otherwise the behavior is undefined.

Parameters

node1

The starting node of the edge.

node2

The ending node of the edge.

weight

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