Recently, the problem of community detection has attracted the attention of many scientists. Most types of networks such as computer networks, biological networks and social networks, have a community structure. Community detection helps to understand the structure and properties of that real network. There have been many algorithms with different approaches, including coordinating vertices and building appropriate distances between them. In this paper, a random walk has been used to coordinate the vertices of the graph and use the cosine of the angle between two vectors to detect network communities. The article also presents the Modularity function to evaluate graph clustering. Some experimental results on randomly generated graphs and graphs generated from the real data set Zachary's karate club network have been presented and compared with the K-means++ algorithm.