class Racc::States

def traverse(i, index, vertices, map, relation)

def traverse(i, index, vertices, map, relation)
  vertices.push i
  index[i] = height = vertices.size
  if rp = relation[i]
    rp.each do |proci|
      unless index[proci]
        traverse proci, index, vertices, map, relation
      end
      if index[i] > index[proci]
        # circulative recursion !!!
        index[i] = index[proci]
      end
      map[i] |= map[proci]
    end
  end
  if index[i] == height
    while true
      proci = vertices.pop
      index[proci] = @infinity
      break if i == proci
      map[proci] |= map[i]
    end
  end
end