Near linear time algorithm to detect community structures in large-scale networks