Graphs with given diameter and a coloring problem