Graph

interface Graph<T>

A generic, immutable graph structure.

Parameters

T

the type of vertices in the graph

Inheritors

Properties

Link copied to clipboard
abstract val edges: Set<Pair<T, T>>

The set of edges in the graph, represented as pairs of vertices.

Link copied to clipboard
abstract val vertices: Set<T>

The set of vertices in the graph.

Link copied to clipboard

Converts a Graph into a VisitableOnceGraph which allows visiting each vertex only once.

Functions

Link copied to clipboard
open fun addEdge(pair: Pair<T, T>): Graph<T>

abstract fun addEdge(from: T, to: T): Graph<T>

Adds an edge from one vertex to another.

Link copied to clipboard
abstract fun addVertex(value: T): Graph<T>

Adds a vertex to the graph.

Link copied to clipboard
abstract fun getNeighbors(vertex: T): Sequence<T>