### The SHC algorithm

The phenomenon of synchronization often appears in physics, it can be expressed as follows. Two or more dynamic systems both have their own evolution and mutual coupling. This effect can be either one-way or two-way streets. When meets certain conditions, the output of these systems will eventually converge and completely be equal under the influence of coupling, this process is called synchronization. The Kuramotom model [36, 37] is applied widely as the simple model of synchronization behavior, the generalized definition of Kuramotom model is shown as follows:

**Definition 1** (Generalize Kuramoto model): The Kuramoto model consists of a population of *N* coupled phase oscillators *θ*_{
i
}(*t*) whose dynamics are governed by:

{\theta}_{i}={\omega}_{i}+\sum _{j=1}^{N}{K}_{ij}\mathsf{\text{sin}}\left({\theta}_{j}-{\theta}_{i}\right)

(1)

where *ω*_{
i
} is its natural frequencies and is distributed with a given probability density *g*(*ω*).

Each oscillator tries to run independently at its own frequency, while the coupling tends to synchronize it to all the others.

The sync algorithm is a novel approach for clustering inspired by the powerful concept of synchronization. It regards each data object as a phase oscillator, and each dimension coordinates corresponding to a phase value of the oscillator. Each object couples with data objects in its *ε*-neighborhood, where *ε* is the neighborhood radius. In the effect of synchronization coupling, the object's coordinates are transformed constantly, and objects with the same coordinates will be classified eventually to the same cluster, namely synchronization completion. Let *x* ∈ *R*^{d} represents an object in the dataset X and *x*_{
i
} be the *i*-th dimension of the object *x*. The transformation formula of coordinate of *x* shows as follows.

{x}_{i}\left(t+1\right)={x}_{i}\left(t\right)+\frac{1}{\left|{N}_{\epsilon}(x(t))\right|}{\displaystyle \sum}_{y\in {N}_{\epsilon}(x(t))}\mathrm{sin}({y}_{i}\left(t\right)-{x}_{i}\left(t\right))

(2)

where *ε*-neighborhood is defined in **Definition 2** below.

**Definition 2** (*ε*-neighborhood): The *ε*-neighborhood radius of an object is a collection of data with distances to the object less than *ε*:

{N}_{\epsilon}\left(x\right)=\left\{y\in X|dist\left(x,y\right)\le \epsilon \right\}

(3)

where *dist*(*x,y*) is the metric function of distance and the Euclidean distance is often used. If the object *y* ∈ *N*_{
ε
}(*x*), *y* is called the *ε*-neighborhood of *x*, denoted by *x* →_{
ε
} *y*. The relationship of *ε*-neighborhood between objects is symmetrical, namely if *x* →_{
ε
} *y* then *y* →_{
ε
} *x*.

For reducing the dynamic interaction time of synchronization of data in the sync algorithm, the concept of neighborhood closures is proposed in SHC algorithm. Objects in a *ε*-neighborhood closure will reach synchronization complete eventually. So it can detect the clusters even if the objects have not yet reached the same coordinates by classifying data in the same neighborhood closures to the same cluster, which reduces the dynamic interaction time of data.

**Definition** 3 (*ε*-neighborhood closures): Suppose objects set *X'* ⊆ *X*, in the dynamic process of synchronous clustering, if ∀*x*, *y* ∈ *X'* satisfies *x* →_{
ε
} *y*, and if ∀*x* ∈ *X*, *x* →_{
ε
} *z*, then *z* ∈ *X'*, *X'* is called an *ε*-neighborhood closure, that is, for any object *x* ∈ *X'*, *N*_{
ε
}(*x*) = *X'* is established.

a_{1}, a_{2}, a_{3}, a_{4} form a *ε*-neighborhood closure in the Figure 1, and will reach complete synchronization eventually.

The optimal value of synchronous neighborhood radius needs to be determined in both the sync algorithm and the SHC algorithm. The SHC algorithm determines synchronous neighborhood radius by means of the hierarchical search that the sync algorithm does. The process of hierarchical search for the optimization of the neighborhood radius shows as follows. Starting in a small neighborhood radius value *ε*, then adding an increment (marked as Δ*ε*) to *ε* at a time (*ε* = *ε* + Δ*ε*) until the neighborhood radius is large enough to contain all objects. Clustering in each neighborhood radius of *ε*, and it is considered to be optimal when the *ε* gets the best result of clustering.

### The FA

The FA is a random optimization algorithm constructed by simulating the group behavior of the fireflies. There are two important elements in the FA, the light intensity and the attractiveness. The former reflects the advantages and disadvantages of locations of fireflies and the latter determines the movement distances of fireflies attracted. The optimization process of the algorithm is implemented through updating the light intensity and the attractiveness constantly. The mathematical mechanism of the FA is described as follows.

The relative value of the light intensity of fireflies is expressed as:

I={I}_{0}\times {e}^{-\gamma {r}_{ij}}

(4)

where *I*_{
0
} is the initial light intensity (*r* = 0) related to the objective function value, the higher the value of objective function is, the stronger the initial light intensity *I*_{
0
} will be. *γ* is the light absorption coefficient set to reflect the features that the light intensity decreases gradually along with the increase of the distance and the absorption of the medium. It can be set to a constant. *r*_{
ij
} is the space distance between firefly *i* and firefly *j*.

The attractiveness of firefly is expressed as:

\beta ={\beta}_{0}\times {e}^{-\gamma {r}_{ij}^{2}}

(5)

where *β*_{0} is the maximum of attractiveness. *γ* and *r*_{
ij
} are the same as above.

If firefly *i* moves to firefly *j*, the updating of location of firefly *i* is expressed as:

{x}_{i}\left(t+1\right)={x}_{i}\left(t\right)+\beta \times \left({x}_{j}\left(t\right)-{x}_{i}\left(t\right)\right)+\alpha \times \left(rand-1/2\right)

(6)

where *x*_{
i
}(*t*), *x*_{
j
}(*t*) are the space coordinates of firefly *i* and firefly *j* at the time *t*, *α* is step-size in [0, 1], *rand* is a random factor that follows uniform distribution in [0, 1].

Fireflies are distributed to the solution space randomly first of all. Each firefly has its own light intensity according to its location, the light intensity is calculated according to Eq. (4). The firefly with low light intensity is attracted by and moving to the firefly with higher light intensity. The movement distance depends on the attractiveness between them calculated by Eq. (5). The location updating of the fireflies is cumulated based on Eq. (6). There is a disturbing term in the process of updating the location, which enlarges the search area and avoids the algorithm to fall into the local optimum too early. Finally all fireflies will gather in the location of the maximum light intensity.

### The proposed clustering algorithm

The sync algorithm clusters objects based on the principle of dynamic synchronization, which has many advantages in that it reflects the intrinsic structure of the dataset. For example, it can detect clusters of arbitrary number, shape and size and not depend on any assumption of distribution. In addition, it can handle outliers since the noise will not synchronize to cluster objects. However, the running time of the algorithm consists of two parts primarily: The dynamic interaction time of synchronization of data and the process of determining the optimal value of synchronous neighborhood radius, which is too long to process large-scale data.

Aiming to reduce the dynamic interaction time of the sync algorithm, the concept of *ε*-neighborhood closures is proposed in the SHC algorithm. It classifies objects in the same neighborhood closures to a cluster even if objects have not yet reached the same coordinate, which enhances the efficiency of the algorithm by reducing the time of dynamic interaction of data. However, the SHC algorithm determines synchronous neighborhood radius by means of hierarchical search that the sync algorithm does. The hierarchical search for synchronous neighborhood radius not only has low efficiency but also has two shortcomings. Firstly, the hierarchical search is very difficult to find the optimal value of synchronous neighborhood radius in a fixed increment. Secondly, the increment Δ*ε* needs to be adjusted according to different data distributions. For example, in the SHC algorithm, the initial value of *ε* is set to the average distance of all objects of its three nearest neighbors. The increment Δ*ε* is the different value of the average distance of all objects to its four nearest neighbors minus the average distance of all objects to its three nearest neighbors. So the running time of the SHC algorithm is very huge when the dataset is uniform and dispersive. In addition, we must set Δ*ε* small when the data distribution is approximate, otherwise it is hard to find the optimal value of synchronous neighborhood radius.

The FA is a swarm intelligent optimization algorithm developed by simulating the glowing characteristics of fireflies, which is speedy and precise in the optimization process. Using the firefly algorithm to search for the optimal neighborhood radius of synchronous can overcome the drawbacks of the hierarchical search. It adopts fewer searching steps for the optimal value of synchronous neighborhood radius and gets more accurate results than the hierarchical search due to its intelligent searching strategies. So it saves time on determining the optimal value of synchronous neighborhood radius. In addition, it is applicable to any data distributions. So we improve the SHC algorithm by means of the FA and apply the proposed algorithm to clustering PPI data.

#### Preprocessing of PPI data

The PPI data is expressed as a graph, called PPI network, in which each node represents a protein and the edge between two nodes represent the interaction between proteins. In that way, we get an *n***n* adjacency matrix of nodes. However, the dimension of the adjacency matrix is too big to deal with. Inspired by the spectral clustering, we use the following way to reduce the dimension of the adjacency matrix of PPI.

First, a similarity matrix *A*of nodes is constructed as follow.

{A}_{ij}=\left\{\begin{array}{cc}\hfill \eta \frac{|{N}_{i}\cap {N}_{j}|+1}{min\left({N}_{i},{N}_{j}\right)}+\left(1-\eta \right)\frac{{\sum}_{k\in {I}_{ij}}w\left(i,k\right)\cdot {\sum}_{k\in {I}_{ij}}w\left(j,k\right)}{{\sum}_{s\in {N}_{i}}w\left(i,s\right)\cdot {\sum}_{t\in {I}_{j}}w\left(j,t\right)}\hfill & \hfill i\ne j\hfill \\ \hfill 0,\hfill & \hfill i=j\hfill \end{array}\right.

(7)

where *N*_{
i
}, *N*_{
j
} are neighbor nodes of nodes *u* and *v* respectively. *I*_{
ij
} is the common neighbors of *i* and *j*, *w*(*i,j*) is the weight between *i* and *j* to measure the interaction strength, and *η* is constant between 0 and 1.

Eq. (7) considers two aspects of the aggregation coefficient of edges and the weighted aggregation coefficient of edges [38–40]. The first half of Eq. (7) is the aggregation coefficient of edges based on degree, which is portrayed by means of the ratio between adding 1 to the number of common neighbors of two protein nodes and minimal value of the number of neighbors of two nodes. The second half of Eq. (7) is the weighted aggregation coefficient of edges, which is illustrated by the ratio between the product of summation of weight values of edges respectively connecting these two nodes (*i, j*) with their common neighbors (*k*) and the product of summation of weight values of edges linking these two nodes (*i, j*) with their corresponding neighbors (*s, t*). In addition, we use *η* to balance the weight of the two parts.

Then constructing Laplacian matrix *L*of matrix *A*, the *D*is the diagonal matrix in which (*i, i*)-element is the sum of *A*'s *i*-th row.

{L}_{ij}=\left\{\begin{array}{cc}\hfill 0\hfill & \hfill {D}_{ii}=0|{D}_{jj}=0\hfill \\ \hfill \frac{{A}_{ij}}{\sqrt{{D}_{ii}{D}_{jj}}}\hfill & \hfill else\hfill \end{array}\right.

(8)

Matrix *X*consists of eigenvectors of matrix *L*'s corresponding to the first three eigenvalues and *X* is normalized. *X*is an *n**3 matrix, in which lines represent the protein objects (corresponding to the protein nodes in PPI network) and columns are the three-dimensional space coordinates of the protein objects. Our proposed clustering algorithm is calculated based on *X*.

#### Design of solution space

The solution space of the position of the firefly corresponds to the neighborhood radius of synchronization. The initial light intensity *I*_{0} of one firefly is assigned by the calculation result of objective function, see Eq.(9), which is expressed as the evaluation of clustering results based on the neighborhood radius of the firefly. Moving to the firefly with higher light intensity is regarded as to search for the optimal value of synchronous neighborhood radius. The position of the firefly with the highest light intensity means the optimal value of synchronous neighborhood radius.

#### Definition of objective function

We choose the following object function to evaluate the clustering results. Clusters with higher value of the objective function mean the stronger modularity of clusters, namely, a better clustering result.

fval={\sum}_{i=1}^{x}\left\{{\left(2\cdot {m}_{{H}_{i}}/\left({n}_{{H}_{i}}+{m}_{{H}_{i}}\right)\right)}^{\rho}\cdot {\left(\sum _{u,v\in {H}_{i},w\left(u,v\right)\in W}w\left(u,v\right)/\sum _{u,v\in {H}_{i},w\left(v,k\right)\in W}w\left(v,k\right)\right)}^{1-\rho}\right\}

(9)

Where *m*_{
H
} is the number of edges that connect points in the cluster *H*_{
i
} , *n*_{
H
} is the number of edges that connect points in the cluster *H*_{
i
} with points out of the cluster *H*_{
i
}, *w*(*u,v*) is the weight between point *u* and point *v*, *x* is the number of clusters, *W* is the set of connections.

The first half of the Eq. (9) is the summation of the ratio of its in-degree to the sum of its in-degree and its out-degree, the second part is the summation of the ratio of its weighted in-degree to the sum of its weighted in-degree and its weighted out-degree. The two parts calculate modularity respectively. We can change the proportion of two parts by adjusting the parameter *ρ*.

#### Flow chart of the algorithm

Figure 2 is the flow chart of the improved synchronization-based hierarchical clustering algorithm.

The detailed procedures of the improved SHC algorithm are as follows.

**Step 1** Construct a similarity matrix *A*of protein objects, and then get Laplacian matrix *L*of the matrix *A*. Matrix *X*consist of the matrix *L*'s eigenvector that the top three eigenvalues corresponded. *X*is an *n**3 matrix, in which the rows represent protein objects and the columns are the three-dimensional space coordinates of protein objects.

**Step 2** The setting of parameters: the number of firefly *N*, the maximum of attractiveness *β*_{0}, the light absorption coefficient *γ*, step-size *α*, Maximum iterations *maxiter*, *iter* = 0.

**Step 3** Initialize the location of firefly in the solution space of the neighborhood radius *ε* of synchronization.

**Step 4** Do clustering respectively based on the synchronous in *ε* that each firefly corresponding.

**Step 4.1** Find *ε*-neighborhood closures of protein objects of matrix *X*. Objects that belong to the same closures are divided into a cluster, and then mark those objects.

**Step 4.2** If all points are marked, return to the result of clustering, otherwise the unmarked objects couple with the objects in its *ε*-neighborhood according to the formula (2), and then go to **step 4.1**.

**Step 5** The light intensity of fireflies are assigned by the calculation result of the objective function (9) according to the clustering result. Compare the brightness of fireflies, if *I*_{
i
} >*I*_{
i
}, calculate the attractiveness according formula (5), and then update the location of firefly *i* according to the formula (6).

**Step 6** *iter* = *iter*+1;

**Step 7** If *iter* <= maxiter, *go* to **Step 4**, otherwise output the clustering result that the firefly with the highest light intensity.

#### The time complexity of algorithm

The time complexity of the SHC algorithm is *O*(*T*·*n*^2) in a certain neighborhood radius, where *n* is the number of nodes, *T* is the number of synchronization to form *ε*-neighborhood closures. Assuming that the number of dynamic interaction of synchronization of data to form *ε*-neighborhood closures will not change in different neighborhood radiuses, the time complexity of the SHC algorithm is *O*(*k*·*T*·*n*^2), *k* is the number of iterations of searching for the optimal *ε*-neighborhood radius based on the hierarchical search. Replacing the hierarchical search with FA results in the decrease of *k*, it enhances the efficiency of the algorithm.