This paper combines the graph theory and P system to solve the clustering problem. In order to effectively identify clusters with arbitrary shapes and uneven densities, we combine MkNN clustering algorithm and graph theory to propose a mutual
-nearest neighbors graph (MkNNG) clustering algorithm. In order to further improve the efficiency of MkNNG algorithm, based on the non-determinism and great parallelism of P system, a cell-like P system with multi-promoters and multi-inhibitors named mutual
-nearest neighbors graph P system (MkNNG-P) is designed. And then based on MkNNG-P system, a novel clustering algorithm named MkNNG-P clustering algorithm is proposed, which uses the membrane objects and rules to solve the clustering problem. MkNNG-P algorithm first calculates the dissimilarity between any two nodes in
membranes in parallel. After then it uses one membrane to get
-nearest neighbors of
nodes. Finally, one membrane is used to find mutual
-nearest neighbors and construct MkNNG to discover the natural clusters in the data set. Experiments show that MkNNG-P algorithm has the advantages of both MkNNG and P system. It not only can obtain good clustering quality for data of different sizes and shapes without presetting clustering numbers, but also has extremely high computing speed.