| Algorithm 2. LocationHistoryModeling | |
| Input: Collection of users GPS logs, userLogs | |
| Output: Tree-Based Hierarchical Graph (TBHG) | |
| 1 | Foreach user do |
| 2 | trajectory = LogParsing(userLogs); |
| 3 | S = StayPointDetection(trajectory); |
| 4 | LocH = PersonalLocHis(S); //individual user |
| 5 | SP.add(S); //collection of stay points |
| 6 | H = HierarchicalClustering(SP); |
| 7 | Foreach level do //build a graph on each level |
| 8 | Foreach user do |
| 9 | g = graphBuilding(g, LocH); |
| 10 | G.add(g); |
| 11 | TBHG = (H, G); |
| 12 | Return TBHG; |