MutableGraph

interface MutableGraph<V : Any, E : Any> : Graph<V, E>

Represents a mutable graph.

Author

Alexander Kornilov (akornilov.82@gmail.com).

Functions

addEdge
Link copied to clipboard
abstract fun addEdge(edge: Edge<V, E>): Edge<V, E>
Adds a new edge.
open fun addEdge(startFrom: V, endWith: V, value: E, isOriented: Boolean = true, isDynamicWeight: Boolean = false, hasWeight: Boolean = true, weight: Double = Edge.DefaultWeight): Edge<V, E>
Creates and add a new edge to the graph by several parameters.
addVertex
Link copied to clipboard
abstract fun addVertex(value: V): Vertex<V, E>
Adds new vertex to graph by value.
clear
Link copied to clipboard
abstract fun clear()
Clears the graph.
clone
Link copied to clipboard
abstract override fun clone(): Graph<V, E>
Clones the graph.
cloneAsMutable
Link copied to clipboard
abstract fun cloneAsMutable(): MutableGraph<V, E>
Clones the graph as MutableGraph.
contains
Link copied to clipboard
open operator fun contains(value: V): Boolean
Returns true if graph contains value; false otherwise.
open operator fun contains(edge: Edge<V, E>): Boolean
Returns true if graph contains edge; false otherwise.
get
Link copied to clipboard
abstract operator fun get(value: V): Vertex<V, E>
Returns vertex by value.
getEdges
Link copied to clipboard
abstract fun getEdges(startFrom: V, endWith: V, limit: Int = -1): Collection<Edge<V, E>>
Returns list of the edges which starts from startFrom and ends with endWith.
isConnected
Link copied to clipboard
open fun isConnected(startFrom: V, endWith: V): Boolean
Returns true if startFrom and endWith vertexes are connected; false otherwise.
minusAssign
Link copied to clipboard
open operator fun minusAssign(value: V)
Removes the vertex by value as operator "-=".
open operator fun minusAssign(edge: Edge<V, E>)
Removes the edge as operator "-=".
plusAssign
Link copied to clipboard
open operator fun plusAssign(value: V)
Adds new vertex for value as operator "+=".
open operator fun plusAssign(edge: Edge<V, E>)
Adds new edge as operator "+=".
removeEdge
Link copied to clipboard
abstract fun removeEdge(edge: Edge<V, E>)
Removes edge from the graph.
removeEdges
Link copied to clipboard
open fun removeEdges(startFrom: V, endWith: V): Int
Removes all edges between startFrom and endWith.
removeVertex
Link copied to clipboard
abstract fun removeVertex(value: V)
Removes the vertex by value.

Properties

dynamicEdgesCount
Link copied to clipboard
abstract val dynamicEdgesCount: Int
A number of edges with mutable weight.
edgesCount
Link copied to clipboard
abstract val edgesCount: Int
A total number of edges in the graph.
isEmpty
Link copied to clipboard
open val isEmpty: Boolean
Indicates that the graph is empty.
isOriented
Link copied to clipboard
open val isOriented: Boolean
Indicates that the graph has only oriented edges.
orientedEdgesCount
Link copied to clipboard
abstract val orientedEdgesCount: Int
A number of oriented edges.
values
Link copied to clipboard
abstract val values: Collection<V>
A list of vertexes values.
vertexes
Link copied to clipboard
abstract val vertexes: Collection<Vertex<V, E>>
A list of vertexes.