class HierarchicalGraph::Node
Attributes
data[R]
graph[R]
id[R]
Public Class Methods
new(graph, id, data={})
click to toggle source
# File lib/hierarchical_graph/node.rb, line 6 def initialize(graph, id, data={}) @graph = graph @id = id @data = data end
Public Instance Methods
[](key)
click to toggle source
# File lib/hierarchical_graph/node.rb, line 12 def [](key) data[key] end
[]=(key, value)
click to toggle source
# File lib/hierarchical_graph/node.rb, line 16 def []=(key, value) data[key] = value end
ancestors()
click to toggle source
# File lib/hierarchical_graph/node.rb, line 32 def ancestors graph.ancestors_of id end
children()
click to toggle source
# File lib/hierarchical_graph/node.rb, line 28 def children graph.children_of id end
descendants()
click to toggle source
# File lib/hierarchical_graph/node.rb, line 36 def descendants graph.descendants_of id end
descendants_subgraph()
click to toggle source
# File lib/hierarchical_graph/node.rb, line 40 def descendants_subgraph graph.descendants_subgraph_from id end
parents()
click to toggle source
# File lib/hierarchical_graph/node.rb, line 24 def parents graph.parents_of id end
root?()
click to toggle source
# File lib/hierarchical_graph/node.rb, line 20 def root? parents.empty? end
to_s()
click to toggle source
# File lib/hierarchical_graph/node.rb, line 44 def to_s "<#{self.class.name} #{id} parents:[#{parents.map(&:id).join(', ')}] children:[#{children.map(&:id).join(', ')}]>" end
Also aliased as: inspect