Commuting graphs and extremal centralizers