class Seafoam::Node
A node, with properties, input edges, and output edges.
Attributes
id[R]
inputs[R]
outputs[R]
props[R]
Public Class Methods
new(id, props = nil)
click to toggle source
# File lib/seafoam/graph.rb, line 45 def initialize(id, props = nil) props ||= {} @id = id @inputs = [] @outputs = [] @props = props end
Public Instance Methods
adjacent()
click to toggle source
All adjacent nodes - from input and output edges.
# File lib/seafoam/graph.rb, line 59 def adjacent (inputs.map(&:from) + outputs.map(&:to)).uniq end
edges()
click to toggle source
All edges - input and output.
# File lib/seafoam/graph.rb, line 54 def edges inputs + outputs end
id_and_label()
click to toggle source
id (label)
# File lib/seafoam/graph.rb, line 64 def id_and_label if props[:label] "#{id} (#{props[:label]})" else id.to_s end end
inspect()
click to toggle source
Inspect.
# File lib/seafoam/graph.rb, line 73 def inspect "<Node #{id}>" end