class Werk::Utils::Graph
- Werk::Utils::Graph
- Reference
- Object
Overview
Minimal implementation for a Directed Acyclic Graph.
Defined in:
werk/utils/graph.crConstructors
-
.new
Creates a new empty graph.
Instance Method Summary
-
#add_edge(from : String, to : String)
Adds an edge between two vertices.
-
#add_vertex(name : String)
Add a new vertex to the graph
-
#get_vertices
Get all vertices for the graph
-
#topological_sort
Return the vertices of the graph sorted topologically.
Constructor Detail
def self.new
#
Creates a new empty graph. The implementation uses an adjacency list representation for the graph.
Instance Method Detail
def add_edge(from : String, to : String)
#
Adds an edge between two vertices. If the vertices don't exist they will be automatically added.
def topological_sort
#
Return the vertices of the graph sorted topologically. The algorithm uses clustered output to allow for parallel processing.