
commonMain.io.github.alexandrepiveteau.graphs.Vertex.kt Maven / Gradle / Ivy
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)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy