## 4 Proposed Method
### Policy Mining with Visual Representation
#### 4.1.2 Visual Representation for Authorizations  
**Definition 3**. : _(\(A_{op}\)) represents the Boolean matrix form for a list of authorizations \(A\) with operation op, where the rows correspond to users, and the columns correspond to objects. This can be represented as follows:_  
\[A_{op}[i][j]=\left\{ \begin{array}{ll}1,if&u_{i}&\text{is allowed to perform op on }o_{j}\\ 0,\text{otherwise}&\end{array} \right.. \tag{7}\]  
**Example 2**. : _An illustrative ABAC authorization matrix \(A_{op}\) is shown in Table 5, which includes 10 users and 10 objects. An equivalently rearranged matrix \(A_{op}\)' is presented in Table 6. We only mark the cells whose values are 1 for an intuitive representation. Obviously, it is more convenient to analyze and handle \(A_{op}\)', which provides a motivation for functionally representing \(A_{op}\)._  
\begin{table}
\begin{tabular}{l l l l l l l l l l l l l l l l l l l l l  
To visually represent the authorization matrix, we use the Hamming distance to rearrange it as defined below. **Definition 4**. : _(Visual representation problem for authorizations) Given an authorization matrix \(A_{op}\), and a Hamming distance list \(D\) between any two rows of \(A_{op}\), find a rearranged matrix \(A_{op}\)' such that: (1) The sum of distances between the adjacent rows of \(A_{op}\)' is minimum, and (2) the submatrices {\(s_{1},s_{2},\dots\) } are intuitively included in \(A_{op}\)' while covering all the cells with values of 1, which can be formalized as follows_:__  
\[\left\{ \begin{array}{c}\min(\sum\limits_{i}\text{Dis}(A_{op}{{}^{\prime}}[i],A_{op}{{}^{\prime}}[i+1])),\forall\text{Dis}(A_{op}{{}^{\prime}}[i],A_{op}{{}^ {\prime}}[i+1])\in D\\ A_{op}{{}^{\prime}}[i^{\prime}][j^{\prime}]=1,\forall s_{k}\in\{s_{1},s_{2}, \dots\}\quad\text{included in}\quad A_{op}{{}^{\prime}},\forall A_{op}{{}^{ \prime}}[i^{\prime}][j^{\prime}]\quad\text{in}\quad s_{k}\end{array} \right.. \tag{8}\]  
According to Definition 5, we present the process of matrix rearrangement in Algorithm 1. ```
Input: original matrix \(A_{op}\) Output: rearranged matrix \(A_{op}\)'
1. Initialize \(A_{op}{{}^{\prime}}=A_{op}\);
2. Represent \(A_{op}\)' as a list of row vectors: \(A_{op}\)[1], \(A_{op}\)'[2],... ;
3. Identify matrix \(D_{r}\) of the Hamming distances between any two row vectors such that \(\forall i\); \(D_{r}[i][j]=\text{Dis}(A_{op}{{}^{\prime}}[i],A_{op}{{}^{\prime}}[j])\);
4.for each \(A_{op}\)'[\(i\)] in \(A_{op}\)' do
5.if\((\exists A_{op}{{}^{\prime}}[i];D_{r}[i][j]<D_{r}[i][i+1])\)then
6. swap(\(A_{op}{{}^{\prime}}[i+1],A_{op}{{}^{\prime}}[j]\));
7.endif
8.endfor
```  
**Algorithm 1** Matrix rearrangement  
The distance matrix \(D_{r}\) for the original matrix in Table 5 is shown in Table 7, where both the rows and columns correspond to the row vectors, and the values of cells are the Hamming distances between any two rows. According to Algorithm 1, the same (or similar) row vectors are clustered by choosing the minimal distances. Similarly, we can also rearrange \(A_{op}\)' to cluster the same (or similar) column vectors. These clusters of rows and columns then form a submatrix, and several such submatrices together cover all the cells of \(A_{op}\) where \(A_{op}[i][j]=1\). Specifically, since \(D_{r}\)[10][1] = \(D_{r}\)[10][2] = \(D_{r}\)[10][6] = 0, we can swap row vector \(A_{op}\)'[1] with \(A_{op}\)'[8], \(A_{op}\)[2] with \(A_{op}\)'[9], and \(A_{op}\)'[6] with \(A_{op}\)'[7], respectively, and the result in step 1 is shown in Table 8, which clusters the same row vectors together, such as \(\{A_{op}\)'[6], \(A_{op}\)'[1], \(A_{op}\)'[2], \(A_{op}\)'[10]}, \(\{A_{op}\)'[5], \(A_{op}\)'[7]}, and \(\{A_{op}\)'[8], \(A_{op}\)'[9], \(A_{op}\)'[3], \(A_{op}\)'[4]}. Subsequently, we implement the rearrangement towards the column vectors.