Community Detection, Label Propagation, Python, Networkx, Graph.
given below : First we create LPA function with some changes. def LPA(g, node): neighbours = [] for i in g.neighbors(node): neighbours.append(i) label_neighbours = [] for i in range(0, len(neighbours)): label_neighbours.append(unique_labels[neighbours[i]]) ## to find argmax counted_labels =