connect

fun connect(node1: T, node2: T, weight: Number? = null)

Connects two nodes in the graph, by calling addEdge(node1,node2, weight) and addEdge(node2, node1, weight)

Parameters

node1

The first node to connect.

node2

The second node to connect.

weight

The weight of the connection (required for weighted graphs). Defaults to null.

Throws

IllegalStateException

If no weight is provided for a weighted graph.