Modularity and Dynamics on Complex Networks