Learning node attributes in graphs with application in social networks