Mathematical aspects of Wiener index