class Graph::Edge

An edge in a graph.

Public Class Methods

new(graph, from, to) click to toggle source

Create a new edge in graph from from to to.

Calls superclass method
# File lib/graph.rb, line 544
def initialize graph, from, to
  super graph
  self.from = from
  self.to = to
end

Public Instance Methods

decorate(decorate) click to toggle source

Sets the decorate attribute. Decorate connects the label to the deg with a line

# File lib/graph.rb, line 554
def decorate decorate
  self.attributes << "decorate = #{decorate}"
end
to_s() click to toggle source

Returns the edge in dot syntax.

# File lib/graph.rb, line 562
def to_s
  fromto = "%p -> %p" % [from.name, to.name]
  if self.attributes? then
    "%-20s [ %-20s ]" % [fromto, attributes.join(',')]
  else
    fromto
  end
end