Class: Yargi::EdgeSet
- Inherits:
-
ElementSet
- Object
- Array
- ElementSet
- Yargi::EdgeSet
- Defined in:
- lib/yargi/edge_set.rb
Overview
A set of edges
Class Method Summary collapse
-
.[](*elements) ⇒ Object
Creates a VertexSet instance using elements varargs.
Instance Method Summary collapse
-
#source ⇒ Object
(also: #sources)
Returns a VertexSet with back-reachable vertices using the edges of this set.
-
#source=(source) ⇒ Object
Fired to each edge in the set.
-
#target ⇒ Object
(also: #targets)
Returns a VertexSet with reachable vertices using the edges of this set.
-
#target=(target) ⇒ Object
Fired to each edge in the set.
Methods inherited from ElementSet
#+, #-, #[], #add_marks, #compact, #concat, #dup, #each_cons, #each_slice, #filter, #find_all, #flatten, #get_mark, #grep, #partition, #reject, #reverse, #select, #set_mark, #sort, #tag, #uniq
Class Method Details
.[](*elements) ⇒ Object
Creates a VertexSet instance using elements varargs.
9 10 11 |
# File 'lib/yargi/edge_set.rb', line 9 def self.[](*elements) EdgeSet.new(elements) end |
Instance Method Details
#source ⇒ Object Also known as: sources
Returns a VertexSet with back-reachable vertices using the edges of this set.
23 24 25 |
# File 'lib/yargi/edge_set.rb', line 23 def source VertexSet.new(self.collect {|e| e.source}).uniq end |
#source=(source) ⇒ Object
Fired to each edge in the set
31 32 33 |
# File 'lib/yargi/edge_set.rb', line 31 def source=(source) self.each{|e| e.source=source} end |
#target ⇒ Object Also known as: targets
Returns a VertexSet with reachable vertices using the edges of this set.
16 17 18 |
# File 'lib/yargi/edge_set.rb', line 16 def target VertexSet.new(self.collect {|e| e.target}).uniq end |
#target=(target) ⇒ Object
Fired to each edge in the set
36 37 38 |
# File 'lib/yargi/edge_set.rb', line 36 def target=(target) self.each{|e| e.target=target} end |