A model was developed to generate the complex degradation pathway of contaminants initiated by hydroxyl radical in the advanced oxidation processes. The model abstracts chemical structures into mathematic graphs. The manipulation of the graphs enumerates the reactions among the large number of molecules, radicals, and other intermediates in the advanced oxidation processes. Using Canonical Simplified Molecular Input Line Entry Specification (Canonical SMILE) representation, the algorithm was able to simulate the reaction of contaminants containing both chain and ring structures. The input chemicals, reaction pattern, and the reaction rules could be specified by users through a graphical user interface. The degradation pathway of Atrazine was used as an example to demonstrate the capability of the algorithm. The generated reaction pathways were compared with those reported in literatures.