We present an algorithm to determine topological invariants of inhomogeneous systems, such as alloys, disordered crystals, or amorphous systems. Based on the kernel polynomial method, our algorithm allows us to study samples with more than $10^7$ degrees of freedom. Our method enables the study of large complex compounds, where disorder is inherent to the system. We use it to analyse Pb$_{1-x}$Sn$_{x}$Te and tighten the critical concentration for the phase transition.