class Node

Attributes

neighbours[RW]

Public Class Methods

new(attributes) click to toggle source
# File lib/rgraph/node.rb, line 4
def initialize(attributes)
  @attributes = attributes
  @neighbours = []
end

Public Instance Methods

[](attribute) click to toggle source
# File lib/rgraph/node.rb, line 17
def [](attribute)
  @attributes[attribute]
end
degree() click to toggle source
# File lib/rgraph/node.rb, line 9
def degree
  @neighbours.size
end
has_neighbour?(node) click to toggle source
# File lib/rgraph/node.rb, line 13
def has_neighbour?(node)
  @neighbours.include?(node)
end