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 = nil, edges : Enumerable(Tuple(V, V)) | Nil = nil, weights : Enumerable(W) | Nil = nil, labels : Enumerable(L | Nil) | Nil = nil, *, default_weight : W | Nil = nil, &block : -> L | Nil)
- .new(vertices : Enumerable(V) | Nil = nil, edges : Enumerable(Tuple(V, V)) | Nil = nil, weights : Enumerable(W) | Nil = nil, labels : Enumerable(L | Nil) | Nil = nil, *, default_weight : W | Nil = nil, default_label : L | Nil = nil)
- .new(edges : Enumerable(AnyEdge(V)), *, default_weight : W | Nil = nil, &block : -> L | Nil)
- .new(edges : Enumerable(AnyEdge(V)), *, default_weight : W | Nil = nil, default_label : L | Nil = nil)
Instance Method Summary
- #add_edge(edge : AnyEdge(V))
- #add_vertex(v : V)
- #clear
- #each_adjacent(u : V, & : V -> )
- #each_adjacent(u : V) : Iterator(V)
- #each_vertex(& : V -> )
- #each_vertex : Iterator(V)
- #has_edge?(u : V, v : V, weight : W, label : L | Nil) : 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 | Nil
The block triggered for default edge labels.
- #label_of(u : V, v : V) : L | Nil
- #label_of?(u : V, v : V) : L | Nil
-
#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 | Nil
-
#weighted? : Bool
Whether edges are weighted.
Constructor Detail
def self.new(vertices : Enumerable(V) | Nil = nil, edges : Enumerable(Tuple(V, V)) | Nil = nil, weights : Enumerable(W) | Nil = nil, labels : Enumerable(L | Nil) | Nil = nil, *, default_weight : W | Nil = nil, &block : -> L | Nil)
#
def self.new(vertices : Enumerable(V) | Nil = nil, edges : Enumerable(Tuple(V, V)) | Nil = nil, weights : Enumerable(W) | Nil = nil, labels : Enumerable(L | Nil) | Nil = nil, *, default_weight : W | Nil = nil, default_label : L | Nil = nil)
#
def self.new(edges : Enumerable(AnyEdge(V)), *, default_weight : W | Nil = nil, &block : -> L | Nil)
#
def self.new(edges : Enumerable(AnyEdge(V)), *, default_weight : W | Nil = nil, default_label : L | Nil = nil)
#