Class: Yargi::EdgeSet

Inherits:
ElementSet show all
Defined in:
lib/yargi/edge_set.rb

Overview

A set of edges

Class Method Summary collapse

Instance Method Summary collapse

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

#sourceObject 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

#targetObject 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