## Appendix A All Constraints in an MILP Formulation for Rank-2 Chemical Graphs
### Assigning Chemical Elements and Valence Condition  
We include constraints so that each vertex \(v\) in a selected graph \(H\) satisfies the valence condition; i.e., \(\sum_{uv\in E(H)}\beta(uv)\leq\operatorname{val}(\alpha(u))\). With these constraints, a rank-2 chemical graph \(G=(H,\alpha,\beta)\) on a selected subgraph \(H\) will be constructed. **constants:**  
A set \(\Lambda\cup\{e\}\) of chemical elements, where \(e\) denotes null;  
\[\sum_{i\in\mathbb{E}_{1,3}(s)}\widehat{\beta}(i)+\sum_{t\in[1,t^{*}]} \widehat{\beta}(s,t)\] \[+\sum_{j\in\text{\rm{Cld}}(1)}\widehat{\beta}(s,j)\leq\sum_{\mathbf{a }\in\Lambda}\text{val}(\mathbf{a})\cdot\delta_{\mathbf{a}}(s,1,\mathbf{a}), s\in[1,s^{*}], \tag{100}\] \[\sum_{s\in[1,s^{*}]}\widehat{\beta}(s,t)+\widehat{\beta}(t,1)+ \widehat{\beta}(t+1,1)\] \[+\sum_{j\in\text{\rm{Cld}}(1)}\widehat{\beta}(s^{*}+t,j)\leq\sum_ {\mathbf{a}\in\Lambda}\text{val}(\mathbf{a})\cdot\delta_{\mathbf{a}}(s^{*}+t, 1,\mathbf{a}), t\in[1,t^{*}],\] (101) \[\widehat{\beta}(p,i)+\sum_{j\in\text{\rm{Cld}}(i)}\widehat{\beta} (p,j)\leq\sum_{\mathbf{a}\in\Lambda}\text{val}(\mathbf{a})\cdot\delta_{ \mathbf{a}}(p,i,\mathbf{a}), p\in[1,\text{cs}^{*}],i\in[2,n_{\text{tree}}]. \tag{102}\]  
**Appendix A.7**: Descriptors for Mass, the Numbers of Elements and Bonds  
We include constraints to compute descriptors \(\overline{\text{m}}\text{s}(G)\)\(\text{ce}^{\text{co}}_{\mathbf{a}}(G)\), \(\text{ce}^{\text{nc}}_{\mathbf{a}}(G)\) (\(\mathbf{a}\in\Lambda\)), \(b_{k}(G)\) (\(k\in[2,3]\)) and \(n_{\text{H}}(G)\) according to the definitions in Section 2.1.2. **constants:**  
A function \(\text{mass}^{*}:\Lambda\to\mathbb{Z}\); Let \(\text{mass}(\mathbf{a})\) denote the observed mass of a chemical element \(\mathbf{a}\in\Lambda\), and define \(\text{mass}^{*}(\mathbf{a})=\lfloor 10\cdot\text{mass}(\mathbf{a})\rfloor\);  
**variables:**  
\(\text{ce}^{\text{co}}(\mathbf{a})\in[0,n^{*}]\), \(\mathbf{a}\in\Lambda\);  
\(\text{ce}^{\text{nc}}(\mathbf{a})\in[0,n^{*}]\), \(\mathbf{a}\in\Lambda\);  
\(\text{Mass}\in\mathbb{Z}\);  
\(\text{b}^{\text{co}}(k)\in[0,2n^{*}]\), \(k\in[1,3]\);  
\(n_{\text{H}}\in[0,4n^{*}]\): the number of hydrogen atoms to be included in \(G\);  
**constraints:**  
\[\sum_{p\in[1,\text{cs}^{*}]}\delta_{\mathbf{a}}(p,1,\mathbf{a}) =\text{ce}^{\text{co}}(\mathbf{a}), \text{a}\in\Lambda, \tag{103}\] \[\sum_{p\in[1,\text{cs}^{*}],j\in[2,n_{\text{tree}}]}\delta_{ \mathbf{a}}(p,i,\mathbf{a}) =\text{ce}^{\text{nc}}(\mathbf{a}), \text{a}\in\Lambda,\] (104) \[\sum_{\mathbf{a}\in\Lambda}\text{mass}^{*}(\mathbf{a})(\text{ce}^ {\text{co}}(\mathbf{a})+\text{ce}^{\text{nc}}(\mathbf{a}))=\text{Mass},\] (105) \[\sum_{i\in\mathbb{E}_{1}\cup\mathbb{E}_{3}}\delta_{\widehat{ \beta}}(i,k)+\sum_{s\in[1,s^{*}],j\in[1,t^{*}]}\delta_{\widehat{\beta}}(s,t,k)\] \[+\sum_{t\in[2,t^{*}]}\delta_{\widehat{\beta}}(t,1,k) =\text{b}^{\text{co}}(k), k\in[1,3],\] (106) \[+\sum_{j\in\text{\rm{Cld}}(1)}\widehat{\beta}(s,j)\leq\sum_{\mathbf{a }\in\Lambda}\text{val}(\mathbf{a})\cdot\delta_{\mathbf{a}}(s,1,\mathbf{a}), s\in[1,s^{*}], \tag{100}\]0 (107) \[+\sum_{j\in\text{\rm{Cld}}(1)}\widehat{\beta}(s,j)\leq\sum_{\mathbf{a }\in\Lambda}\text{val}(\mathbf{a})\cdot\delta_{\mathbf{a}}(s,1,\mathbf{a}), s\in[1,s^{*}], \tag{100}\]1 \[+\sum_{j\in\text{\rm{Cld}}(1)}\widehat{\beta}(s,j)\leq\sum_{\mathbf{a }\in\Lambda}\text{val}(\mathbf{a})\cdot\delta_{\mathbf{a}}(s,1,\mathbf{a}), s\in[1,s^{*}], \tag{100}\]2  
**Appendix A.8**: Descriptor for the Number of Specified Degree  
We include constraints to compute descriptors \(\text{dg}_{i}(G)\) (\(i\in[1,4]\)) according to the definitions in Section 2.1.2. We also add constraints so that the maximum degree of a non-core vertex in \(H\) is at most 3 (resp., equal to 4) when \(d_{\text{max}}=3\) (resp., \(d_{\text{max}}=4\)).