Optimal Representation of Large-Scale Graph Data Based on Grid Clustering and K2-Tree
Algorithm 1
Grid clustering.
Input: an adjacency matrix M, a density threshold that satisfies the minimum density, and a distance threshold that plots the maximum distance between the grids.
Output: a boundary_ list contains the cluster boundary information and an adjacency matrix M0 for which the cluster is removed. A cluster_ list contains the position of the small grid in each cluster.
(1)
Divide the adjacency matrix M into N2/d2 grids, denoted as n;
(2)
n: = Number of grids to be filtered; List : empty queue, Boundary : empty queue;
(3)
for (i = 1 to n)
(4)
if ( >= density threshold) then
(5)
add to the List;
(6)
end if
(7)
end for
(8)
Flag := 1;
(9)
while (Flag == 1)
(10)
m := List.size ();
(11)
for (i = 1 to m)
(12)
for (j = 2 to m)
(13)
if (Distance (,) <= distance threshold&& Isaccessed () == false) then
(14)
Classify and into one class and mark as accessed;
(15)
end if
(16)
end for
(17)
Mark as accessed, count the density of all meshes belonging to the same class as , and merge them into a large grid. The grid name is recorded as ;
(18)
if ( >= density threshold) then
(19)
add to the cluster_ list;
(20)
end if
(21)
end for
(22)
if (List! = cluster_ list) then//If the results of the two clusters are inconsistent, iterate again;
(23)
Flag := 1;//Iteration end flag;
(24)
List := cluster_ list;
(25)
cluster_ list := [];
(26)
else
(27)
Flag := 0;//Iteration end flag;
(28)
end while
(29)
Record the boundary value of each grid in the cluster_ list, store this value in the boundary_ list, and extract each cluster in the list from the original adjacency matrix, and the extracted adjacency matrix is termed M0;