DirectedAcyclicGraph

A class which represents a simple directed acyclic graph.

Parameters

<T>

Class for the data objects of this graph.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
open fun addEdge(@NonNull node: @NonNull T, @NonNull incomingEdge: @NonNull T)
Add an edge to the graph.
Link copied to clipboard
open fun addNode(@NonNull node: @NonNull T)
Add a node to the graph.
Link copied to clipboard
open fun clear()
Clears the internal graph, and releases resources to pools.
Link copied to clipboard
open fun contains(@NonNull node: @NonNull T): Boolean
Returns true if the node is already present in the graph, false otherwise.
Link copied to clipboard
@Nullable
open fun getIncomingEdges(@NonNull node: @NonNull T): @Nullable List<T>
Get any incoming edges from the given node.
Link copied to clipboard
@Nullable
open fun getOutgoingEdges(@NonNull node: @NonNull T): @Nullable List<T>
Get any outgoing edges for the given node (i.e.
Link copied to clipboard
@NonNull
open fun getSortedList(): @NonNull ArrayList<T>
Returns a topologically sorted list of the nodes in this graph.
Link copied to clipboard
open fun hasOutgoingEdges(@NonNull node: @NonNull T): Boolean
Checks whether we have any outgoing edges for the given node (i.e.