Application of graphs to the theory of basicity of end groups in polymethine dyes