1: for  $i^{\mathrm{th}}$  nice subset of users  $\mathcal{M}^{(\ell ,i)}\in \mathcal{M}^{(\ell)}$  with active items  $\mathcal{N}^{(\ell ,i)}$  ( $i^{\mathrm{th}}$  set in list  $\mathcal{N}^{(\ell)}$ ) do
2: Set  $t = t_0$ . Set  $\epsilon_{\ell + 1} = \epsilon_{\ell} / 2$ ,  $\Delta_{\ell} = \epsilon_{\ell} / 88\mathsf{C}$  and  $\Delta_{\ell + 1} = \epsilon_{\ell + 1} / 88\mathsf{C}$ .
3: Run exploit component for users in  $\mathcal{M}^{(\ell, i)}$  with active items  $\mathcal{N}^{(\ell, i)}$ . Obtain updated active set of items, round index and exploit rounds  $\mathcal{N}^{(\ell, i)}, t, t_{\text{exploit}} \gets \text{Exploit\_Item\_Cluster}(\mathcal{M}^{(\ell, i)}, \mathcal{N}^{(\ell, i)}, t, t_{\text{exploit}}, \widetilde{\mathbf{P}}_{\mathcal{M}^{(\ell, i)}, \mathcal{N}^{(\ell, i)}}, \Delta_{\ell})$ .
4: Set  $d_{1} = \max (|\mathcal{M}^{(\ell ,i)}|,|\mathcal{N}^{(\ell ,i)}|)$ ,  $d_{2} = \min (|\mathcal{M}^{(\ell ,i)}|,|\mathcal{N}^{(\ell ,i)}|)$  and  $p = c\Big(\frac{\sigma^2\mu^3\log d_1}{\Delta_{\ell + 1}^2d_2}\Big)$  for some appropriate fixed constant  $c > 0$ .
5: if  $|\mathcal{N}^{(\ell ,i)}|\geq \mathsf{T}^{1 / 3}$  and  $p <   1$  then
6: Run explore component for users in  $\mathcal{M}^{(\ell, i)}$  with active items  $\mathcal{N}^{(\ell, i)}$ . Obtain updated estimate and round index  $\widetilde{\mathbf{P}}, t \gets \text{Explore}_i\text{Item}_i\text{Cluster}(\mathcal{M}^{(\ell, i)}, \mathcal{N}^{(\ell, i)}, t, p)$  such that  $\left|\left|\widetilde{\mathbf{P}}_{\mathcal{M}^{(\ell, i)}, \mathcal{N}^{(\ell, i)}} - \mathbf{P}_{\mathcal{M}^{(\ell, i)}, \mathcal{N}^{(\ell, i)}}\right|\right|_{\infty} \leq \Delta_{\ell+1}$  w.h.p.
7: For every user  $u \in \mathcal{M}^{(\ell, i)}$ , compute  $\mathcal{T}_u^{(\ell)} \equiv \{j \in \mathcal{N}^{(\ell, i)} \mid \widetilde{\mathbf{P}}_{u\pi_u(T - t_{exploit})} - \widetilde{\mathbf{P}}_{uj} \leq 2\Delta_{\ell + 1}\}$ .
8: Construct graph  $\mathcal{G}^{(\ell, i)}$  whose nodes are users in  $\mathcal{M}^{(\ell, i)}$  and an edge exists between two users  $u, v \in \mathcal{M}^{(\ell, i)}$  if  $\left|\widetilde{\mathbf{P}}_{ux}^{(\ell)} - \widetilde{\mathbf{P}}_{vx}^{(\ell)}\right| \leq 2\Delta_{\ell+1}$  for all arms  $x \in \mathcal{N}^{(\ell, i)}$ .
9: Initialize lists  $\mathcal{M}_i^{(\ell +1)} = []$  and  $\mathcal{N}_i^{(\ell +1)} = []$ .
10: For each connected component  $\mathcal{M}^{(\ell, i, j)} \left( \cup_{j} \mathcal{M}^{(\ell, i, j)} \right. \equiv \mathcal{M}^{(\ell, i)}$ , compute  $\mathcal{N}^{(\ell, i, j)} \equiv \cup_{u \in \mathcal{M}^{(\ell, i, j)}} \mathcal{T}_u^{(\ell)}$ .
11: For each connected component  $\mathcal{M}^{(\ell, i, j)}$ , construct graph  $\mathcal{G}_{\text {item }}^{(\ell, i, j)}$  whose nodes are items in  $\mathcal{N}^{(\ell, i)}$  and an edge exists between two items  $u, v \in \mathcal{N}^{(\ell, i)}$  if  $\left|\widetilde{\mathbf{P}}_{xu}^{(\ell)} - \widetilde{\mathbf{P}}_{xv}^{(\ell)}\right| \leq 16C\Delta_{\ell+1}$  for all users  $x \in \mathcal{M}^{(\ell, i, j)}$ . Update  $\mathcal{N}^{(\ell, i, j)}$  to be the set of items  $\mathcal{N}^{(\ell, i, j)} \equiv \{x \in \mathcal{N}^{(\ell, i)} \mid x \text{ is connected with some node in } \mathcal{N}^{(\ell, i, j)}\}$ .
12: Invoke B-LATTICE  $(\ell + 1, \mathcal{M}_i^{(\ell + 1)}, \mathcal{N}_i^{(\ell + 1)}, C, T.\sigma^2, t, t_{\text{exploit}}, \widetilde{\mathbf{P}}, \epsilon_{\ell + 1}, \mathbf{K}, \mathcal{G}_{\text{item}}^{(\ell, i, j)})$
13: else
14: For each user  $u \in \mathcal{M}^{(\ell, i)}$ , recommend  $\mathsf{T} - t$  unblocked items in  $\mathcal{N}^{(\ell, i)}$  until end of rounds.
15: end if
16: end for