Diagrammatic approach to the intermediate-valence compounds