addEdge

fun addEdge(sourceVertex: Vertex, targetVertex: Vertex)

Add an edge to the graph from the source vertex to the target vertex. Fail if either vertex is not present in the graph or if it already contains an edge from the source vertex to the target vertex.

Parameters

sourceVertex

The source of the edge to attempt to add.

targetVertex

The target of the edge to attempt to add.