Edge

interface Edge<T, W>

A directed, optionally-weighted edge of a Graph, going from source to destination; an unweighted edge (as used e.g. by Graph.build<T, Nothing> { ... }) simply carries a null weight. Build one via Edge.of, or the edgeOf top-level shorthand. Two Edges connecting the same source and destination with the same weight are ==-equal, since the default implementation returned by Edge.of is a data class; a bidirectional connection is modelled as two separate Edges (see MutableGraph.connect).

Type Parameters

T

is the type of the payload carried by the source/destination nodes

W

is the type of this edge's weight

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
abstract val destination: Node<T>

The node this edge points to.

Link copied to clipboard
abstract val source: Node<T>

The node this edge originates from.

Link copied to clipboard
abstract val weight: W?

This edge's weight, or null if the graph it belongs to is unweighted (or this edge has no weight).