Class: DiameterMeasure

Inherits:
Measure show all
Defined in:
lib/gimuby/genetic/archipelago/measure/diameter_measure.rb

Overview

Return the diameter of an archipelago If archipelago is not connex, simply output twice number of its nodes

Instance Method Summary collapse

Instance Method Details

#compute(archipelago) ⇒ Object



10
11
12
13
14
15
# File 'lib/gimuby/genetic/archipelago/measure/diameter_measure.rb', line 10

def compute(archipelago)
  unless is_connected(archipelago)
    return 2 * archipelago.get_nodes.length
  end
  get_biggest_shortest_paths(archipelago)
end