commonMain.io.github.alexandrepiveteau.graphs.Vertex.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-graphs Show documentation
Show all versions of kotlin-graphs Show documentation
Model directed, undirected, weighted and unweighted graphs and perform computations on them in Kotlin multiplatform.
package io.github.alexandrepiveteau.graphs
import kotlin.jvm.JvmInline
/**
* A vertex in a [Graph], which is uniquely identified. Vertices can be compared to each other, and
* are totally ordered within a [Graph] instance.
*
* @param index the index of the vertex within a [Graph]. Unique and non-negative in valid [Graph]s.
*/
@JvmInline
public value class Vertex(public val index: Int) {
override fun toString(): String = "Vertex #$index"
public companion object {
/** A [Vertex] with an identifier which is known not to be valid in a [Graph]. */
public val Invalid: Vertex = Vertex(-1)
}
}