Implementation of method addAttribute in Link and Node classes