Topological indices are calculated based on the molecular graph, which is a mathematical representation of the molecule where atoms are represented as vertices, and bonds are represented as edges. Commonly used topological indices include the Wiener index, the Hosoya index, and the Zagreb indices. These indices take into account various aspects of the molecular graph, such as path lengths, degree of vertices, and connectivity.