class Tangle::Directed::Edge
An edge in a directed graph
Attributes
head[R]
tail[R]
Public Instance Methods
each_vertex(&block)
click to toggle source
# File lib/tangle/directed/edge.rb, line 21 def each_vertex(&block) [@tail, @head].each(&block) end
head?(vertex)
click to toggle source
# File lib/tangle/directed/edge.rb, line 13 def head?(vertex) @head == vertex end
tail?(vertex)
click to toggle source
# File lib/tangle/directed/edge.rb, line 17 def tail?(vertex) @tail == vertex end
to_s()
click to toggle source
# File lib/tangle/directed/edge.rb, line 25 def to_s "{#{@tail}-->#{@head}}" end
Also aliased as: inspect
Private Instance Methods
initialize_vertices(tail, head = tail)
click to toggle source
Calls superclass method
Tangle::Edge#initialize_vertices
# File lib/tangle/directed/edge.rb, line 32 def initialize_vertices(tail, head = tail) super @tail = tail @head = head @vertices = { tail => head }.freeze end