Class: Tangle::Undirected::Edge
- Defined in:
- lib/tangle/undirected/edge.rb
Overview
An edge in an undirected graph, connecting two vertices
Instance Attribute Summary
Attributes inherited from Edge
Attributes included from Mixin::Initialize
Instance Method Summary collapse
- #each_vertex(&block) ⇒ Object
- #to_s ⇒ Object (also: #inspect)
Methods inherited from Edge
#[], #include?, #initialize, #loop?, #walk
Constructor Details
This class inherits a constructor from Tangle::Edge
Instance Method Details
#each_vertex(&block) ⇒ Object
12 13 14 |
# File 'lib/tangle/undirected/edge.rb', line 12 def each_vertex(&block) @vertices.each_key(&block) end |
#to_s ⇒ Object Also known as: inspect
16 17 18 19 |
# File 'lib/tangle/undirected/edge.rb', line 16 def to_s vertex1, vertex2 = @vertices.keys "{#{vertex1}<->#{vertex2}}" end |