Algorithms and Dynamical Models for Communities and Reputation in Social Networks