Class: Rubigraph::Edge

Inherits:
Object
  • Object
show all
Defined in:
lib/rubigraph.rb

Overview

Edge between Vertexes

Instance Method Summary collapse

Constructor Details

#initialize(from, to, id = Rubigraph.genid) ⇒ Edge

create an Edge. from, to should be Vertex.



82
83
84
85
# File 'lib/rubigraph.rb', line 82

def initialize(from, to, id = Rubigraph.genid)
  @id = id
  Rubigraph.call('ubigraph.new_edge_w_id', id, from.id, to.id)
end

Instance Method Details

#arrow=(a) ⇒ Object



143
144
145
# File 'lib/rubigraph.rb', line 143

def arrow=(a)
  set_attribute('arrow', a)
end

#color=(c) ⇒ Object



101
102
103
# File 'lib/rubigraph.rb', line 101

def color=(c)
  set_attribute('color', c)
end

#colour=(c) ⇒ Object



105
106
107
# File 'lib/rubigraph.rb', line 105

def colour=(c)
  self.color=(c)
end

#fontcolor=(c) ⇒ Object



117
118
119
# File 'lib/rubigraph.rb', line 117

def fontcolor=(c)
  set_attribute('fontcolor', c)
end

#fontfamily=(f) ⇒ Object



121
122
123
124
# File 'lib/rubigraph.rb', line 121

def fontfamily=(f)
  # TODO: should assert 'Helvetica' | 'Times Roman'
  set_attribute('fontfamily', f)
end

#fontsize=(s) ⇒ Object



126
127
128
129
# File 'lib/rubigraph.rb', line 126

def fontsize=(s)
  # TODO: should assert 10, 12, 18. 24
  set_attribute('fontsize', s)
end

#label=(l) ⇒ Object



109
110
111
# File 'lib/rubigraph.rb', line 109

def label=(l)
  set_attribute('label', l)
end

#labelpos=(p) ⇒ Object



113
114
115
# File 'lib/rubigraph.rb', line 113

def labelpos=(p)
  set_attribute('labelpos', p)
end

#orientationweight=(o) ⇒ Object



135
136
137
# File 'lib/rubigraph.rb', line 135

def orientationweight=(o)
  set_attribute('orientationweight', o)
end

#removeObject



87
88
89
# File 'lib/rubigraph.rb', line 87

def remove
  Rubigraph.call('ubigraph.remove_edge', @id)
end

#set_attribute(att, value) ⇒ Object



91
92
93
# File 'lib/rubigraph.rb', line 91

def set_attribute(att, value)
  Rubigraph.call('ubigraph.set_edge_attribute', @id, att, value.to_s)
end

#set_attributes(attrs) ⇒ Object



95
96
97
98
99
# File 'lib/rubigraph.rb', line 95

def set_attributes(attrs)
  attrs.each do |k, v|
    Rubigraph.call('ubigraph.set_edge_attribute', @id, k, v.to_s)
  end
end

#showstrain=(s) ⇒ Object



147
148
149
# File 'lib/rubigraph.rb', line 147

def showstrain=(s)
  set_attribute('showstrain', s)
end

#strength=(s) ⇒ Object



131
132
133
# File 'lib/rubigraph.rb', line 131

def strength=(s)
  set_attribute('strength', s)
end

#width=(w) ⇒ Object



139
140
141
# File 'lib/rubigraph.rb', line 139

def width=(w)
  set_attribute('width', w)
end