This article proposes a fault component location method based on graph theory and analyzes the properties of the elements in the fault judgment matrix. We can use the exclusive OR algorithm to determine the faulty section. On this basis, the realization model and algorithm essence of the optimal test set is given. At the same time, we propose an optimal test set design for circuit fault diagnosis based on graph theory. Finally, the realization of the article verified that the method adapts to the flexible operation mode of the active distribution network structure and can accurately determine the fault section.