Solution (source code)

= Solution

For simple roots $\alpha_i$, the <Cartan matrix> is
$$
A_{ij}=\langle\alpha_i,\alpha_j^\vee\rangle
=\frac{2(\alpha_i,\alpha_j)}{(\alpha_j,\alpha_j)}.
$$
Its diagonal entries are two, while its off-diagonal entries encode the angles and relative lengths in the <Dynkin diagram>.