Class: GV::Edge
Overview
Represents a connection between nodes
Instance Attribute Summary
Attributes inherited from Component
Instance Method Summary collapse
-
#head ⇒ Node
The head node of the edge.
-
#initialize(graph, name, tail, head) ⇒ Edge
constructor
A new instance of Edge.
-
#tail ⇒ Node
The tail node of the edge.
Methods inherited from Component
#==, #[], #[]=, #hash, #html, #name
Constructor Details
#initialize(graph, name, tail, head) ⇒ Edge
Returns a new instance of Edge.
135 136 137 138 139 |
# File 'lib/gv.rb', line 135 def initialize(graph, name, tail, head) @graph = graph @ptr = Libcgraph.agedge(graph.ptr, tail.ptr, head.ptr, name, 1) end |
Instance Method Details
#head ⇒ Node
Returns the head node of the edge.
142 143 144 |
# File 'lib/gv.rb', line 142 def head Node.new @graph, Libcgraph.aghead(ptr) end |
#tail ⇒ Node
Returns the tail node of the edge.
147 148 149 |
# File 'lib/gv.rb', line 147 def tail Node.new @graph, Libcgraph.agtail(ptr) end |