Self-testing is a technology to certify states and measurements using only the statistics of the experiment. Self-testing is possible if some extremal points in the set of quantum correlations for a Bell experiment are achieved, up to isometries, with specific states and measurements. However, is difficult to characterize, so it is also difficult to prove whether or not a given matrix of quantum correlations allows for self-testing. Here, we show how some tools from graph theory can help to address this problem. We observe that is strictly contained in an easy-to-characterize set associated with a graph, . Therefore, whenever the optimum over and the optimum over coincide, self-testing can be demonstrated by simply proving self-testability with . Interestingly, these maxima coincide for the quantum correlations that maximally violate many families of Bell-like inequalities. Therefore, we can apply this approach to prove the self-testability of many quantum correlations, including some that are not previously known to allow for self-testing. In addition, this approach connects self-testing to some open problems in discrete mathematics. We use this connection to prove a conjecture [M. Araújo et al., Phys. Rev. A, 88, 022118 (2013)] about the closed-form expression of the Lovász theta number for a family of graphs called the Möbius ladders. Although there are a few remaining issues (e.g., in some cases, the proof requires the assumption that measurements are of rank 1), this approach provides an alternative method to self-testing and draws interesting connections between quantum mechanics and discrete mathematics.