Class: SameSame::Dendrogram

Inherits:
Object
  • Object
show all
Defined in:
lib/same_same/dendrogram.rb

Defined Under Namespace

Classes: Level

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Dendrogram



9
10
11
12
# File 'lib/same_same/dendrogram.rb', line 9

def initialize(name)
  self.levels = []
  self.level_label = name
end

Instance Attribute Details

#level_labelObject

Returns the value of attribute level_label.



7
8
9
# File 'lib/same_same/dendrogram.rb', line 7

def level_label
  @level_label
end

#levelsObject

Returns the value of attribute levels.



7
8
9
# File 'lib/same_same/dendrogram.rb', line 7

def levels
  @levels
end

Instance Method Details

#[](i) ⇒ Object



18
19
20
# File 'lib/same_same/dendrogram.rb', line 18

def [](i)
  levels[i]
end

#add_level(name, clusters) ⇒ Object



14
15
16
# File 'lib/same_same/dendrogram.rb', line 14

def add_level( name, clusters )
  self.levels << Level.new(name, clusters.map(&:dup))
end

#non_singelton_leaves?Boolean



22
23
24
# File 'lib/same_same/dendrogram.rb', line 22

def non_singelton_leaves?
  levels.last.clusters.any? {|cluster| cluster.size > 1}
end