The Social Internet of Things (SIoT), integration of Internet of Things and Social networks paradigms, has been introduced to build a network of smart nodes which are capable of establishing social links. In order to deal with misbehavioral service provider nodes, service requestor nodes must evaluate their trustworthiness levels. In this paper, we propose a novel trust management mechanism in the SIoT to predict the most reliable service provider for a service requestor, that leads to reduce the risk of exposing to malicious nodes. We model an SIoT with a flexible bipartite graph (containing two sets of nodes: service providers and requestors), then build the corresponding social network among service requestor nodes, using Hellinger distance. After that, we develop a social trust model, by using nodes' centrality and similarity measures, to extract behavioral trust between the network nodes. Finally, a matrix factorization technique is designed to extract latent features of SIoT nodes to mitigate the data sparsity and cold start problems. We analyze the effect of parameters in the proposed trust prediction mechanism on prediction accuracy. The results indicate that feedbacks from the neighboring nodes of a specific service requestor with high Hellinger similarity in our mechanism outperforms the best existing methods. We also show that utilizing social trust model, which only considers the similarity measure, significantly improves the accuracy of the prediction mechanism. Furthermore, we evaluate the effectiveness of the proposed trust management system through a real-world SIoT application. Our results demonstrate that the proposed mechanism is resilient to different types of network attacks and it can accurately find the proper service provider with high trustworthiness.