# User Mobility Modeling in Crowdsourcing Application to Prevent Inference Attacks
## 4 Proposed Approach
### POI Extraction
#### 4.5.3 POI Extraction Using the Bayesian Network  
For the extraction of the POI, we have developed and implemented an algorithm based on a Bayesian network. This algorithm utilizes a probabilistic model to analyze and evaluate locations based on various attributes derived from users' location histories. The goal is to determine whether a specific location can be classified as a POI, which is essential for constructing our mobility graph. The Algorithm 5 extracts and evaluates the POIs using decision analysis and returns a reduced graph. The process begins by iterating through each vertex \(v\) in graph \(G\). For each vertex, it retrieves the location metadata, specifically the \"category\". It then examines each edge \(e\) connected to \(v\) as the source node and retrieves the weight \(\mathcal{W}\) for the edge. For each tuple \(\langle ts,td,fs,st\rangle\) in \(\mathcal{W}\), the algorithm sets evidence in the Bayesian network with the elements \(td,ts,fs,andst\). Using the Bayesian network, it identifies the posterior probabilities for the category, \(fs\) and \(st\), and computes the utility \(U\) based on the Bayesian network evidence and utilities. If the computed utility \(U\) meets or exceeds the threshold \(t\), the vertex \(v\) is added to the reduced graph \(G_{reduced}\). Subsequently, for each edge \(e^{\prime}\) connected to \(v\), if the edge \(e^{\prime}\) is not already in the reduced graph, it assigns a weight \(\langle ts,td,fs,st,dt\rangle\) to the edge. If the edge \(e^{\prime}\) has contextual metadata, it associates these metadata using the function \(f_{m}\). The edge \(e^{\prime}\) is then added to the reduced graph \(G_{reduced}\). The algorithm ensures that the weight of the relation \(\langle ts,td,fs,st\rangle\) is updated if it already exists. Finally, the reduced graph \(G_{reduced}\) is returned. ```
1:Input:\(G\) - user's mobility graph
2:\(t\) - utility threshold
3:\(bn\) - Bayesian network (with decision node for POI)
4:Output:\(G_{reduced}\) - Reduced graph
5:Initialize an empty list \(V_{selected}\) to store selected vertices
6:for each \(v\) in \(G.V\)do
7:\(category\leftarrow\) RetrieveLocationMetadataByName(\(v\),\"category\")
8:for each edge \(e\in G.\mathcal{E}\) where \(e\) is connected to \(v\) as the source node do
9: Retrieve \(\mathcal{W}\) for edge \(e\)
10:for each \(\langle ts,td,fs,st\rangle\) in \(\mathcal{W}\)do
11: Set evidence in \(bn\) with \(td,ts,fs,st\)
12: Identify posterior probabilities for category, \(fs\) and \(st\) using \(bn\)
13: Compute utility \(U\) based on \(bn\) evidence and utilities
14:if\(U\geq t\)then\(\triangleright\) Check if the computed utility meets or exceeds the threshold
15:\(V_{selected}\gets V_{selected}\cup\{v\}\)
16:endif
17:endfor
18:endfor
19:endfor\(\triangleright\) Construct \(G_{reduced}\) by verifying relations between vertices in \(V_{selected}\)
20:for each \(v\) in \(V_{selected}\)do
21:\(G_{reduced}.\mathcal{V}\leftarrow\)\(G_{reduced}.\mathcal{V}\cup\{v\}\)
22:for each edge \(e^{\prime}\in G.\mathcal{E}\) where \(e^{\prime}\) is connected to \(v\)do
23:if target node of \(e^{\prime}\) is in \(V_{selected}\) and \(e^{\prime}\
otin G_{reduced}.\mathcal{E}\)then
24: Assign \(e^{\prime}\) weight \(\langle ts,td,fs,st\rangle\)
25:if\(e^{\prime}\) has contextual metadata then
26: Associate \(e^{\prime}\) with its contextual metadata using \(f_{m}\)
27:endif
28:\(G_{reduced}.\mathcal{E}\gets G_{reduced}.\mathcal{E}\cup\{e^{\prime}\}\)
29:endif
30:endfor
31:endfor
32:return\(G_{reduced}\)\(\triangleright\) Return the reduced graph
```  
**Algorithm 5** Reduced Graph Generation and Extraction of Points of Interest.