Module: TraceVisualization::BurrowsWheelerTransform

Defined in:
lib/trace_visualization/bwt.rb

Class Method Summary collapse

Class Method Details

.bwt(str, sa, n) ⇒ Object

Attention! This implementation work correctly only when the string ends with TERMINATION_CHAR that greater of all possible chars in the lexicographical order


27
28
29
# File 'lib/trace_visualization/bwt.rb', line 27

def self.bwt(str, sa, n)
Array.new(n) { |i| str[sa[i] - 1] }		
end

.naive(str) ⇒ Object


20
21
22
# File 'lib/trace_visualization/bwt.rb', line 20

def self.naive(str)
  (0 ... str.length).collect{ |i| (str * 2)[i, str.length]}.sort.map{|x| x[-1]}
end