compute ranking