Edge Estimation and Community Detection in Time-varying Networks