working version of louvain for one pass