Class: Tangle::Undirected::Edge

Inherits:
Edge
  • Object
show all
Defined in:
lib/tangle/undirected/edge.rb

Overview

An edge in an undirected graph, connecting two vertices

Instance Attribute Summary

Attributes inherited from Edge

#name

Attributes included from Mixin::Initialize

#mixins

Instance Method Summary collapse

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_sObject 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