Class: Node

Inherits:
Object
  • Object
show all
Defined in:
lib/priority-queue/benchmark/dijkstra.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id) ⇒ Node

Returns a new instance of Node.



10
11
12
13
# File 'lib/priority-queue/benchmark/dijkstra.rb', line 10

def initialize(id)
  @neighbours = []
  @id = id
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



8
9
10
# File 'lib/priority-queue/benchmark/dijkstra.rb', line 8

def id
  @id
end

#neighboursObject (readonly)

Returns the value of attribute neighbours.



8
9
10
# File 'lib/priority-queue/benchmark/dijkstra.rb', line 8

def neighbours
  @neighbours
end

Instance Method Details

#inspectObject



15
16
17
# File 'lib/priority-queue/benchmark/dijkstra.rb', line 15

def inspect
  to_s
end

#to_sObject



19
20
21
# File 'lib/priority-queue/benchmark/dijkstra.rb', line 19

def to_s
  "(#{@id})"
end