Implement generic version of edge replace and update.