added modularity graph routine and graph initialization constructor