addEdge

abstract fun addEdge(node1: T, node2: T, weight: Double = 1.0)

Adds a directed edge from node1 to node2. See the implementing class for how undefined nodes are handled.

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.


fun addEdge(node1: T, node2: T, weight: Int)

Overloaded function that calls addEdge with weight converted to a double.