  Let $G$ be a graph and let $m_{ij}(G)$, $i,j\ge 1$, be the number of edges
$uv$ of $G$ such that $\{d_v(G), d_u(G)\} = \{i,j\}$. The {\em $M$-polynomial}
of $G$ is introduced with $\displaystyle{M(G;x,y) = \sum_{i\le j}
m_{ij}(G)x^iy^j}$. It is shown that degree-based topological indices can be
routinely computed from the polynomial, thus reducing the problem of their
determination in each particular case to the single problem of determining the
$M$-polynomial. The new approach is also illustrated with examples.
