module CGL::AdjacencyHash(V, W, L)
Overview
Reusable adjacency list representation for an AnyGraph
.
Uses a hash table to associate each vertex V
with a set of adjacent
vertices. The set is backed by another hash table that can be used to store
arbitrary data of type L
and a weight of type W
with each edge.
Direct including types
Defined in:
cgl/representations/adjacency.crConstructors
- .new(vertices : Enumerable(V)? = nil, edges : Enumerable(Tuple(V, V))? = nil, weights : Enumerable(W)? = nil, labels : Enumerable(L?)? = nil, *, default_weight : W? = nil, &block : -> L?)
- .new(vertices : Enumerable(V)? = nil, edges : Enumerable(Tuple(V, V))? = nil, weights : Enumerable(W)? = nil, labels : Enumerable(L?)? = nil, *, default_weight : W? = nil, default_label : L? = nil)
- .new(edges : Enumerable(AnyEdge(V)), *, default_weight : W? = nil, &block : -> L?)
- .new(edges : Enumerable(AnyEdge(V)), *, default_weight : W? = nil, default_label : L? = nil)
Instance Method Summary
- #add_edge(edge : AnyEdge(V))
- #add_vertex(v : V)
- #clear
- #each_adjacent(u : V) : Iterator(V)
- #each_adjacent(u : V, & : V -> )
- #each_vertex : Iterator(V)
- #each_vertex(& : V -> )
- #has_edge?(u : V, v : V, weight : W, label : L?) : Bool
- #has_edge?(u : V, v : V, weight, label) : Bool
- #has_edge?(u : V, v : V) : Bool
- #has_vertex?(v : V) : Bool
-
#label_block : -> L?
The block triggered for default edge labels.
- #label_of(u : V, v : V) : L?
- #label_of?(u : V, v : V) : L?
-
#labeled? : Bool
Whether edges are labeled.
- #order : Int32
-
#size : Int32
The number of edges in
self
. - #vertices
- #weight_of(u : V, v : V) : W
- #weight_of?(u : V, v : V) : W?
-
#weighted? : Bool
Whether edges are weighted.
Constructor Detail
def self.new(vertices : Enumerable(V)? = nil, edges : Enumerable(Tuple(V, V))? = nil, weights : Enumerable(W)? = nil, labels : Enumerable(L?)? = nil, *, default_weight : W? = nil, &block : -> L?)
#
def self.new(vertices : Enumerable(V)? = nil, edges : Enumerable(Tuple(V, V))? = nil, weights : Enumerable(W)? = nil, labels : Enumerable(L?)? = nil, *, default_weight : W? = nil, default_label : L? = nil)
#
def self.new(edges : Enumerable(AnyEdge(V)), *, default_weight : W? = nil, default_label : L? = nil)
#