All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.io.github.alexandrepiveteau.graphs.Vertex.kt Maven / Gradle / Ivy

Go to download

Model directed, undirected, weighted and unweighted graphs and perform computations on them in Kotlin multiplatform.

There is a newer version: 0.6.1
Show newest version
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 - 2024 Weber Informatics LLC | Privacy Policy