Sha256: 259d42cce4d48c9fb809cdf6db46754158f88ace8343b2ebc25dd265d5cf81f5
Contents?: true
Size: 1.23 KB
Versions: 1
Compression:
Stored size: 1.23 KB
Contents
module Yargi # A set of edges class EdgeSet < ElementSet ### Factory section ####################################################### # Creates a VertexSet instance using _elements_ varargs. def self.[](*elements) EdgeSet.new(elements) end ### Walking section ####################################################### # Returns a VertexSet with reachable vertices using the edges of this set. def target VertexSet.new(self.collect {|e| e.target}).uniq end alias :targets :target # Returns a VertexSet with back-reachable vertices using the edges of this # set. def source VertexSet.new(self.collect {|e| e.source}).uniq end alias :sources :source ### Writing section ####################################################### # Fired to each edge in the set def source=(source) self.each{|e| e.source=source} end # Fired to each edge in the set def target=(target) self.each{|e| e.target=target} end ### Protected section ##################################################### protected # Extends with EdgeSet instead of ElementSet def extend_result(result) EdgeSet.new(result) end end # module EdgeSet end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
yargi-0.2.0 | lib/yargi/edge_set.rb |