From clusters to phase diagrams: composition rules of quasicrystals and bulk metallic glasses