added weights support for igraph_community_optimal_modularity, closes #511