class
Craph::Graph(T)
- Craph::Graph(T)
- Reference
- Object
Overview
Directed graph using an adjacency list representation.
Direct Known Subclasses
Defined in:
craph/graph.crConstructors
Instance Method Summary
-
#add_edge(from : T, to : T)
Adds an edge between two nodes.
-
#add_node(name : T)
Add a new node to the graph
-
#empty?
Check if the graph has no nodes
-
#has_edge?(from : T, to : T) : Bool
Check if an edge exists between two nodes
-
#has_node?(name : T) : Bool
Check if a node exists in the graph
-
#neighbors(name : T) : Set(T)
Get the neighbors of a node
-
#nodes
Get all nodes in the graph
-
#size
Returns the number of nodes in the graph
Constructor Detail
Instance Method Detail
def add_edge(from : T, to : T)
#
Adds an edge between two nodes. If the nodes don't exist they will be automatically added.