Class: Lrama::Digraph

Inherits:
Object
  • Object
show all
Defined in:
lib/lrama/digraph.rb

Overview

Algorithm Digraph of dl.acm.org/doi/pdf/10.1145/69622.357187 (P. 625)

Instance Method Summary collapse

Constructor Details

#initialize(sets, relation, base_function) ⇒ Digraph

Returns a new instance of Digraph.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/lrama/digraph.rb', line 4

def initialize(sets, relation, base_function)
  # X in the paper
  @sets = sets
  # R in the paper
  @relation = relation
  # F' in the paper
  @base_function = base_function
  # S in the paper
  @stack = []
  # N in the paper
  @h = Hash.new(0)
  # F in the paper
  @result = {}
end

Instance Method Details

#computeObject



19
20
21
22
23
24
25
26
# File 'lib/lrama/digraph.rb', line 19

def compute
  @sets.each do |x|
    next if @h[x] != 0
    traverse(x)
  end

  return @result
end