Reputation based on edge dynamics promotes cooperative behavior