| Algorithm 3. LocationHistoryInference | |
| Input: TBHG=(H,G) and users’ location histories, LocH | |
| Output: Users’ hub scores, S and locations’ authority scores, A. | |
| 1 | S = A = ∅; |
| 2 | Fori = 1; i < |L|; i ++ //on each level |
| 3 | For j = 1; j < |C|; j ++ //on each cluster on the level |
| 4 | For k = i + 1; k ≦ |L|; k ++ //on each sub-level |
| 5 | C = LocationCollecting(k, c, H); |
| 6 | M = MatrixBuilding(C, LocH); |
| 7 | (x,y) = HITS-inference(M); |
| 8 | S = (x); |
| 9 | A = (y); |
| 10 | Return (S,A); |