DirectedGraph

class DirectedGraph<V, E>(    val out: MutableMap<V, MutableMap<V, E>> = mutableMapOf(),     val in: MutableMap<V, MutableSet<V>> = mutableMapOf())(source)

A mutable representation of a directed graph consisting of vertices and directed edges.

Parameters

V

the type representing the vertices in the graph.

E

the type representing the edges in the graph.

Constructors

Link copied to clipboard
constructor(out: MutableMap<V, MutableMap<V, E>> = mutableMapOf(), in: MutableMap<V, MutableSet<V>> = mutableMapOf())

Properties

Link copied to clipboard

a map where keys are vertices, and the values are sets of vertices representing the incoming connections to those vertices.

Link copied to clipboard

a map where the keys represent vertices and the values are maps of adjacent vertices with their associated edge values representing outgoing connections.

Functions

Link copied to clipboard
fun add(vertex: V): DirectedGraph<V, E>
Link copied to clipboard
fun edge(from: V, to: V): E
Link copied to clipboard
fun edges(): Iterable<Edge<V, E>>
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun in(vertex: V): Set<V>
Link copied to clipboard
fun indexOf(vertex: V): Int
Link copied to clipboard
fun link(from: V, to: V, edge: E)

fun link(from: V, to: V, edge: E, merge: (E, E) -> E)

Links two vertices in the directed graph with an edge, merging edges if one already exists.

Link copied to clipboard
fun out(vertex: V): Set<V>
Link copied to clipboard
fun select(selection: Set<V>): DirectedGraph<V, E>
Link copied to clipboard
fun unlink(from: V, to: V)
Link copied to clipboard
fun vertices(): Set<V>