Class: Lrama::Digraph
- Inherits:
-
Object
- Object
- Lrama::Digraph
- 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
- #compute ⇒ Object
-
#initialize(sets, relation, base_function) ⇒ Digraph
constructor
A new instance of Digraph.
Constructor Details
#initialize(sets, relation, base_function) ⇒ Digraph
Returns a new instance of Digraph.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/lrama/digraph.rb', line 28 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
#compute ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'lib/lrama/digraph.rb', line 50 def compute @sets.each do |x| next if @h[x] != 0 traverse(x) end return @result end |