SlowGuess/NeurIPS_2023_OCR huggingface dataset:
We begin with presenting the proofs of Lemma 3 and Lemma 3.2. Proofs of Theorem 3.3 and Proposition 4.2 appear at the end of Sections A.1 and A.2, respectively.
For any causal query  $P_{X}(Y)$  and ADMG  $\mathcal{G}$ , if  $\mathcal{F}$  is a valid identification formula for  $P_{X}(Y)$  in  $\mathcal{G}$  (Def. 2.2), then  $\mathcal{F}$  is a valid identification formula for  $P_{X}(Y)$  in any  $\mathcal{G}' \subseteq \mathcal{G}$ .
Proof. Let  $\mathcal{H} \subseteq \mathcal{G}$  be an arbitrary edge-induced subgraph of  $\mathcal{G}$ . Let  $\mathcal{F}$  be an identification formula for  $P_X(Y)$  in  $\mathcal{G}$ , i.e., for any model  $M$  that induces  $\mathcal{G}$ ,
$$
P _ {X} ^ {M} (Y) = \mathcal {F} \left(P ^ {M} \left(V ^ {\mathcal {G}}\right)\right). \tag {5}
$$
By definition,  $P_X(Y)$  is identifiable in  $\mathcal{G}$ . As a result, there exists and identification formula such as  $\mathcal{F}'$  that can be derived for  $P_X(Y)$  in  $\mathcal{G}$ , using a sequence of do calculus rules and basic probability manipulations. Note that this means for any model  $M$  that induces  $\mathcal{G}$ ,
$$
P _ {X} ^ {M} (Y) = \mathcal {F} ^ {\prime} \left(P ^ {M} \left(V ^ {\mathcal {G}}\right)\right). \tag {6}
$$
Note that an immediate corollary of Equations 5 and 6 is that for any model  $M$  that induces  $\mathcal{G}$
$$
\mathcal {F} \left(P ^ {M} \left(V ^ {\mathcal {G}}\right)\right) = \mathcal {F} ^ {\prime} \left(P ^ {M} \left(V ^ {\mathcal {G}}\right)\right). \tag {7}
$$
Now, we first show that this sequence of actions (combination of do calculus rules and probability manipulations) is valid in  $\mathcal{H}$ . Note that the basic probability manipulations are graph-independent. It only suffices to show that any applied do calculus rule w.r.t.  $\mathcal{G}$  can also be applied w.r.t.  $\mathcal{H}$ . The validity conditions of all three do calculus rules are based on certain d-separations. As a result, it suffices to show that if a d-separation relation is valid in  $\mathcal{G}$ , it is also valid in  $\mathcal{H}$ . To do so, it suffices to show that if all paths between  $Z_{1}$  and  $Z_{2}$  are blocked in  $\mathcal{G}$  given  $W$ , they are blocked in  $\mathcal{H}$  too, for arbitrary disjoint sets of vertices  $Z_{1}, Z_{2}, W \subseteq V^{\mathcal{G}}$ . Take an arbitrary path,  $p$ , between  $Z_{1}$  and  $Z_{2}$  in  $\mathcal{H}$ . Since  $\mathcal{H} \subseteq \mathcal{G}$ , this path exists in  $\mathcal{G}$ . Since  $Z_{1}$  and  $Z_{2}$  are d-separated given  $W$  in  $\mathcal{G}$ , the path  $p$  is blocked by  $W$ . As a result, any path between  $Z_{1}$  and  $Z_{2}$  in  $\mathcal{H}$  is blocked by  $W$ . Therefore, any do-calculus rule applied in  $\mathcal{G}$ , can also be applied in  $\mathcal{H}$ . Hence,  $\mathcal{F}'$  is a valid identification formula for  $P_{X}(Y)$ . That is, for any model  $M$  that induces  $\mathcal{H}$ ,
$$
P _ {X} ^ {M} (Y) = \mathcal {F} ^ {\prime} \left(P ^ {M} \left(V ^ {\mathcal {H}}\right)\right). \tag {8}
$$
Now note that any model  $M$  that induces  $\mathcal{H}$ , i.e., is compatible with  $\mathcal{H}$ , is also compatible with  $\mathcal{G}$ . Also,  $V^{\mathcal{G}} = V^{\mathcal{H}}$ . As a result, from Equations 7 and 8, we know that for any model  $M$  that induces  $\mathcal{H}$
$$
P _ {X} ^ {M} (Y) = \mathcal {F} \left(P ^ {M} \left(V ^ {\mathcal {H}}\right)\right).
$$
By definition,  $\mathcal{F}$  is a valid identification formula for  $P_X(Y)$  in  $\mathcal{H}$ .
Proof. Problem 1. First consider an arbitrary graph  $\mathcal{G}_1 \in [\mathcal{G}]_{Id(Q[Y])}$  such that  $\mathcal{G}_1$  has an edge  $e$  with  $p_e < 1/2$ . Let  $G_2$  denote the graph  $G_1$  after removing  $e$ . Lemma 3 implies that  $\mathcal{G}_2 \in [\mathcal{G}]_{Id(Q[Y])}$ . According to Equation 1, we have  $P(\mathcal{G}_2) = \frac{1 - p_e}{p_e} P(\mathcal{G}_1) > P(\mathcal{G}_1)$  (since  $p_e < 1/2$ ). As a result, the solution  $\mathcal{G}^*$  to Problem 1 (Eq. 2) has no edges with probability less than  $1/2$ . We can therefore rewrite Problem 1 as:
$$
\mathcal{G}^{*}:= \operatorname *{arg  max}_{\substack{\mathcal{G}_{s}\subseteq \mathcal{G},\\ \mathcal{G}_{s}\in [\mathcal{G}]_{Id(Q[Y])}}}P(\mathcal{G}_{s}) = \operatorname *{arg  max}_{\substack{\mathcal{G}_{s}\subseteq \mathcal{G},\\ \mathcal{G}_{s}\in [\mathcal{G}]_{Id(Q[Y])}}}P(\mathcal{G}_{s}) \quad \mathbf{s.t.}\quad \forall e\in \mathcal{G}_{s}:p_{e}\geq \frac{1}{2}.
$$
Or equivalently, we can always assume that we start with a graph  $\mathcal{G}$  that has no edges with probability less than  $1/2$ , as otherwise we can remove all of those edges and the problem does not change. This indeed is equivalent to choosing weight (cost) 0 for those edges in the equivalent edge ID problem. Now assuming that the edges have probability at least  $1/2$ ,
$$
\begin{array}{l} \mathcal{G}^{*} = \operatorname *{arg  max}_{\substack{\mathcal{G}_{s}\subseteq \mathcal{G},\\ \mathcal{G}_{s}\in [\mathcal{G}]_{Id(Q[Y])}}}P(\mathcal{G}_{s}) \\ = \operatorname *{arg  max}_{\substack{\mathcal{G}_{s}\subseteq \mathcal{G},\\ \mathcal{G}_{s}\in [\mathcal{G}]_{Id(Q[Y])}}}\log (P(\mathcal{G}_{s})) \\ = \operatorname *{arg  max}_{\substack{\mathcal{G}_{s}\subseteq \mathcal{G},\\ \mathcal{G}_{s}\in [\mathcal{G}]_{Id(Q[Y])}}}\log (\prod_{e\in \mathcal{G}_{s}}p_{e}\prod_{e\notin \mathcal{G}_{s}}(1 - p_{e})) \\ = \underset { \begin{array}{c} \mathcal {G} _ {s} \in [ \mathcal {G} ] _ {I d (Q [ Y ])} \end{array} } {\arg \max } \sum_ {e \in \mathcal {G} _ {s}} \log (p _ {e}) + \sum_ {e \notin \mathcal {G} _ {s}} \log (1 - p _ {e})) \\ = \operatorname *{arg  max}_{\substack{\mathcal{G}_{s}\subseteq \mathcal{G},\\ \mathcal{G}_{s}\in [\mathcal{G}]_{Id(Q[Y])}}}\sum_{e\in \mathcal{G}_{s}}\log (p_{e}) + \sum_{e\notin \mathcal{G}_{s}}\log (1 - p_{e})) + \sum_{e\in \mathcal{G}_{s}}\log (1 - p_{e})) - \sum_{e\in \mathcal{G}_{s}}\log (1 - p_{e})) \\ \end{array}
$$
Since  $\sum_{e\notin \mathcal{G}_s}\log (1 - p_e)) + \sum_{e\in \mathcal{G}_s}\log (1 - p_e))$  is a constant value that does not depend on  $\mathcal{G}_s$ , it can be ignored in the maximization and we have:
$$
\begin{array}{l} \mathcal{G}^{*} = \operatorname *{arg  max}_{\substack{\mathcal{G}_{s}\subseteq \mathcal{G},\\ \mathcal{G}_{s}\in [\mathcal{G}]_{Id(Q[Y])}}}\sum_{e\in \mathcal{G}_{s}}\log (p_{e}) - \sum_{e\in \mathcal{G}_{s}}\log (1 - p_{e})) \\ = \underset { \begin{array}{c} \mathcal {G} _ {s} \subseteq \mathcal {G}, \\ \mathcal {G} _ {s} \in [ \mathcal {G} ] _ {I d (Q [ Y ])} \end{array} } {\arg \max } \sum_ {e \in \mathcal {G} _ {s}} \log (\frac {p _ {e}}{1 - p _ {e}}) \\ = \operatorname *{arg  min}_{\substack{\mathcal{G}_{s}\subseteq \mathcal{G},\\ \mathcal{G}_{s}\in [\mathcal{G}]_{Id(Q[Y])}}}\sum_{e\notin \mathcal{G}_{s}}\log (\frac{p_{e}}{1 - p_{e}}). \\ \end{array}
$$
From the formulation above, it is clear that if we assign the weight  $w_{e} = \log \left(\frac{p_{e}}{1 - p_{e}}\right)$  to each edge  $e \in E^{\mathcal{G}}$ , we will have an instance of the edge ID problem. Note that for edges with probability higher than  $1/2$ ,  $\log \left(\frac{p_{e}}{1 - p_{e}}\right) \geq 0$ , and this assignment of edge weights satisfies the positivity requirement. For the opposite direction, note that the procedure explained above is reversible by the choice of probabilities  $p_{e} = \frac{\exp(w_{e})}{1 + \exp(w_{e})}$ , which is a value between  $1/2$  and  $1$ .
Problem 2. First note that under Assumption 2.1, for any graph  $\mathcal{G}_s$ ,
$$
\sum_ {\hat {\mathcal {G}} \subseteq \mathcal {G} _ {s}} P (\hat {\mathcal {G}}) = \prod_ {e \notin \mathcal {G} _ {s}} (1 - p _ {e}) [ \sum_ {\hat {E} \subseteq E ^ {\mathcal {G} _ {s}}} \prod_ {e \in \hat {E}} p _ {e} \prod_ {e \notin \hat {E}} (1 - p _ {e}) ] = \prod_ {e \notin \mathcal {G} _ {s}} (1 - p _ {e}).
$$
This is because the inner summation goes over all the possible subsets of  $E^{\mathcal{G}_s}$ , and the summation adds up to 1. Therefore, we can rewrite Problem 2 (Eq. 3) as
$$
\begin{array}{l} \mathcal{H}^{*} = \operatorname *{arg  max}_{\substack{\mathcal{G}_{s}\subseteq \mathcal{G},\\ \mathcal{G}_{s}\in [\mathcal{G}]_{Id(Q[Y])}}}\sum_{\hat{\mathcal{G}}\subseteq \mathcal{G}_{s}}P(\hat{\mathcal{G}}) \\ = \underset { \begin{array}{c} \mathcal {G} _ {s} \subset \mathcal {G}, \\ \mathcal {G} _ {s} \in [ \mathcal {G} ] _ {I d (Q [ Y ])} \end{array} } {\arg \max } \prod_ {e \notin \mathcal {G} _ {s}} (1 - p _ {e}) \\ = \operatorname *{arg  max}_{\substack{\mathcal{G}_{s}\subseteq \mathcal{G},\\ \mathcal{G}_{s}\in [\mathcal{G}]_{Id(Q[Y])}}}\log (\prod_{e\notin \mathcal{G}_{s}}(1 - p_{e})) \\ = \operatorname *{arg  max}_{\substack{\mathcal{G}_{s}\subseteq \mathcal{G},\\ \mathcal{G}_{s}\in [\mathcal{G}]_{Id(Q[Y])}}}\sum_{e\notin \mathcal{G}_{s}}\log (1 - p_{e}) \\ = \operatorname *{arg  min}_{\substack{\mathcal{G}_{s}\subseteq \mathcal{G},\\ \mathcal{G}_{s}\in [\mathcal{G}]_{Id(Q[Y])}}}\sum_{e\notin \mathcal{G}_{s}} - \log (1 - p_{e}). \\ \end{array}
$$
With the same reasoning as before, assigning the weights  $w_{e} = -\log (1 - p_{e})$  to each edge  $e \in E^{\mathcal{G}}$ , we end up with an instance of the edge ID problem. Note that again  $0 \leq -\log (1 - p_{e}) \leq \infty$ . It is noteworthy that this procedure is also reversible with the choice of edge probabilities  $p_{e} = 1 - \exp (-w_{e})$ , which reduces the edge ID problem to an instance of Problem 2. Again note that  $0 \leq 1 - \exp (-w_{e}) \leq 1$  for any non-negative  $w_{e}$ .
A.1 Reduction from MCIP to edge ID
First note that edge ID is in the class of NP problems, since the ID algorithm [26] can verify a solution in polynomial time. To prove Theorem 3.3, we first present a polynomial-time reduction from MCIP to the edge ID problem. It has been shown that the minimum vertex cover problem can be reduced to MCIP in polynomial time [2]. Combining the two reductions, we show that there exists a polynomial-time reduction from the minimum vertex cover problem to the edge ID problem. Since the minimum vertex cover problem is known to be NP-complete [19], it follows that the edge ID problem is also NP-complete.
We propose the following reduction from MCIP to the edge ID problem. Assume we want to solve MCIP given ADMG  $\mathcal{G} = (V^{\mathcal{G}},E_d^{\mathcal{G}},E_b^{\mathcal{G}})$ , query  $Q[Y]$ , and the intervention costs  $C(v)$  for  $v\in V^{\mathcal{G}}$ . We construct a graph, denoted by  $\mathcal{H} = \mathcal{T}_1(\mathcal{G},Y)$ , through the following steps.
a. For every vertex  $x \in V^{\mathcal{G}} \setminus Y$ , add two vertices  $x^{1}, x^{2}$  to  $V^{\mathcal{H}}$ .
b. For any bidirected edge  $\{x,z\} \in E_b^{\mathcal{G}}$  where  $x\in V^{\mathcal{G}}\setminus Y$  and  $z\in V^{\mathcal{G}}$ , add the bidirected edge  $\{x^{2},z^{2}\}$  to  $E_{b}^{\mathcal{H}}$ .
c. For any directed edge  $(x,z)\in E_d^{\mathcal{G}}$  where  $x\in V^{\mathcal{G}}\setminus Y$  and  $z\in V^{\mathcal{G}}$ , add the directed edge  $(x^{1},z^{1})$  to  $E_{d}^{\mathcal{H}}$ .
d. For any bidirected edge  $\{y_1, y_2\} \in E_b^{\mathcal{G}}$  where  $y_1, y_2 \in Y$ , add the bidirected edge  $\{y_1, y_2\}$  to  $E_b^{\mathcal{H}}$ .
e. For every  $x^1, x^2 \in V^\mathcal{G} \setminus Y$ , draw the two edges  $\{x^1, x^2\} \in E_b^\mathcal{H}$  and  $(x^2, x^1) \in E_d^\mathcal{H}$ . Furthermore, the weight of  $\{x^1, x^2\}$  is  $C(x)$ .
f. The costs of the all other edges in  $\mathcal{H}$  are assigned to be infinite.
With abuse of notation, for any vertex  $x \in V^{\mathcal{G}} \setminus Y$ , we define  $\mathcal{T}_1(x) = \{x^2, x^1\} \in E_b^{\mathcal{H}}$ , where  $\{x^2, x^1\}$  is the bidirected edge in  $\mathcal{H}$  that corresponds to  $x$  in  $\mathcal{G}$ , and inherits the same weight (cost).
<sup>6</sup>We later showed that there is a polynomial-time reduction from the minimum hitting set problem to MCIP, resulting in stronger hardness results [3].
(a) The model  $\mathcal{G}$  with costs on each vertex
Figure 5: Reduction of MCIP to edge ID
(b) The model  $\mathcal{G}$  with costs on each edge
Example 2. Consider graph  $\mathcal{G}$  in Figure 5a. Vertices  $x$  and  $z$  are mapped to  $x^1, x^2$ , and  $z^1, z^2$ , respectively. Both a directed and a bidirected edge are drawn between these pairs. The bidirected edge  $\{x^1, x^2\}$  is assigned the weight  $C(x) = c_x$ , and the bidirected edge  $\{z^1, z^2\}$  is assigned the weight  $C(z) = c_z$ . Infinite weights are assigned to the rest of the edges in  $\mathcal{H}$  (Figure 5b).
Proposition A.1. Suppose  $\mathcal{G}'$  is an ADMG,  $Y \subseteq V^{\mathcal{G}'}$  is a set of its vertices such that  $Y$  is a district in  $\mathcal{G}'[Y]$ , and  $\mathcal{H}' = \mathcal{T}_1(\mathcal{G}', Y)$ . Consider  $X \subseteq V^{\mathcal{G}'} \setminus Y$  as an arbitrary subset of vertices of  $\mathcal{G}'$ , and define  $\mathcal{G} = \mathcal{G}'[V^{\mathcal{G}'} \setminus X]$ . Let  $E_b'' = \{e \in E_b^{\mathcal{H}'} | \exists v \in X, e = \mathcal{T}_1(v)\}$  and define  $E_b^{\mathcal{H}} = E_b^{\mathcal{H}'} \setminus E_b''$ . Let  $\mathcal{H}$  be the edge-induced subgraph of  $\mathcal{H}'$  defined as  $\mathcal{H} = (V^{\mathcal{H}'}, E_d^{\mathcal{H}}, E_b^{\mathcal{H}})$ .  $Q[Y]$  is identifiable in  $\mathcal{G}$  if and only if  $Q[Y]$  is identifiable in  $\mathcal{H}$ .
Proof. We prove the contrapositive, i.e.,  $Q[Y]$  is not identifiable in  $\mathcal{G}$  iff  $Q[Y]$  is not identifiable in  $\mathcal{H}$ . Note that by construction,  $Y$  is a district in both  $\mathcal{G}[Y]$  and  $\mathcal{H}[Y]$ . That is, it suffices to show that there exists a hedge formed for  $Q[Y]$  in  $\mathcal{G}$  iff there exists a hedge formed for  $Q[Y]$  in  $\mathcal{H}$ .
To this end, we first prove the following claim. Let  $W \in V^{\mathcal{H}}$  form a hedge for  $Q[Y]$ . If  $x^{1} \in W$  for some  $x \in V^{\mathcal{G}'}$ , then  $x^{2} \in W$  and vice versa. That is, the two vertices  $x^{1}$  and  $x^{2}$  corresponding to the same vertex  $x$  in  $V^{\mathcal{G}'}$  appear only simultaneously in any hedge. To see this, note that by construction,  $x^{1}$  is the only child of  $x^{2}$ . By definition of hedge, if  $x^{2} \in W$ , then it has a directed path to  $Y$  within  $\mathcal{H}[W]$ , and this path can only go through  $x^{1}$ . For the other direction, note that  $x^{1}$  has only one bidirected edge, which is with  $x^{2}$ . Again, by definition of hedge, if  $x^{1} \in W$ , then it has a bidirected path to  $Y$  within  $\mathcal{H}[W]$ , and this path can only go through  $x^{2}$ . Hence, in the sequel, when there is a hedge  $W$  formed for  $Q[Y]$  in  $\mathcal{H}$ , we will without loss of generality assume that there exists a set of variables  $Z \subseteq V^{\mathcal{G}'}$  such that  $W = Z^{1} \cup Z^{2} \cup Y$ , where  $Z^{1} = \{z^{1}|z \in Z\}$  and  $Z^{2} = \{z^{2}|z \in Z\}$ .
If part. Let  $W = Z^{1} \cup Z^{2} \cup Y$  form a hedge for  $Q[Y]$  in  $\mathcal{H}$ . First note that since none of the bidirected edges between  $Z^{1}$  and  $Z^{2}$  are removed in  $\mathcal{H}$ , by construction, all vertices  $Z$  are present in  $\mathcal{G}$ , i.e.,  $Z \subseteq V^{\mathcal{G}}$ . Now we show that  $Z \cup Y$  forms a hedge for  $Q[Y]$  in  $\mathcal{G}$ . To this end, we prove  $\mathcal{G}[Z \cup Y]$  is a district and  $Z \cup Y = \text{Anc}_{\mathcal{G}[Z \cup Y]}(Y)$ . First note that any vertex in  $Z^{1}$  has only one bidirected edge to a vertex in  $Z^{2}$ . That is, if we consider the edge-induced subgraph of  $\mathcal{H}[W]$  over its bidirected edges, vertices of  $Z^{1}$  are leaf nodes. As a result,  $Z^{2} \cup Y$  must be connected in this graph. That is,  $Z^{2} \cup Y$  is a district in  $\mathcal{H}[Z^{2} \cup Y]$ . This implies by construction of  $\mathcal{H}$  that  $\mathcal{G}[Z \cup Y]$  is a single district. With a similar reasoning, note that vertices in  $Z^{2}$  have no parents. As a result,  $Z^{1} \cup Y = \text{Anc}_{\mathcal{H}[Z^{1} \cup Y]}(Y)$  (since the directed paths cannot go through  $Z^{2}$ ). Again, by construction, the edge-induced subgraph of  $\mathcal{G}[Z \cup Y]$  over its directed edges is a copy of  $\mathcal{H}[Z^{1} \cup Y]$ . As a result,  $Z \cup Y = \text{Anc}_{\mathcal{G}[Z \cup Y]}(Y)$ .
Only if part. Let  $Z \cup Y$  form a hedge for  $Q[Y]$  in  $\mathcal{G}$ , where  $Z \subseteq V^{\mathcal{G}} \setminus Y$ . Define  $Z^{1} = \{z^{1}|z \in Z\}$  and  $Z^{2} = \{z^{2}|z \in Z\}$ . We show that  $Z^{1} \cup Z^{2} \cup Y$  forms a hedge for  $Q[Y]$  in  $\mathcal{H}$ . First, by definition of hedge,  $\text{Anc}_{\mathcal{G}[Z \cup Y]}(Y) = Z \cup Y$ . Since the edge-induced subgraph of  $\mathcal{H}[Z^{1} \cup Y]$  is a copy of  $\mathcal{G}[Z \cup Y]$  by construction, we know  $\text{Anc}_{\mathcal{G}[Z^{1} \cup Y]}(Y) = Z^{1} \cup Y$ . Further, each vertex  $z^{2} \in Z^{2}$  is a parent of  $z^{1} \in Z^{1}$ . As a result,  $\text{Anc}_{\mathcal{G}[Z^{1} \cup Z^{2} \cup Y]}(Y) = Z^{1} \cup Z^{2} \cup Y$ . Now it suffices to show that  $Z^{1} \cup Z^{2} \cup Y$  is a district in  $\mathcal{H}[Z^{1} \cup Z^{2} \cup Y]$ . By definition of hedge,  $Z \cup Y$  is a district in  $\mathcal{G}[Z \cup Y]$ . By construction of  $\mathcal{H}$ , exactly the same bidirected edges (and therefore bidirected paths) exist in  $\mathcal{H}[Z^{2} \cup Y]$ . Therefore,  $Z^{2} \cup Y$  is a district in  $\mathcal{H}[Z^{2} \cup Y]$ . Now note that by construction of  $\mathcal{H}'$ , each vertex  $z^{1} \in Z^{1}$  has a bidirected edge to  $z^{2} \in Z^{2}$ . And by definition of  $\mathcal{G}$  and  $\mathcal{H}$ , since the
vertices  $Z$  exist in  $\mathcal{G}$ , none of these edges are removed in  $\mathcal{H}$ . As a result,  $Z^1 \cup Z^2 \cup Y$  is a district in  $\mathcal{H}[Z^1 \cup Z^2 \cup Y]$ , which completes the proof.
Proof of Theorem 3.3. A polynomial-time reduction from MCIP to the edge ID problem follows immediately from Proposition A.1. MCIP is shown to be NP-complete [2]. As a result, the edge ID problem is Np-complete.
A.2 Reduction from edge ID to MCIP
To prove Proposition 4.2, we begin with presenting a transformation  $\mathcal{T}_2(\mathcal{G},Y)$  which is in the core of reduction from edge ID to MCIP.
Suppose we want to solve the edge ID problem given ADMG  $\mathcal{G} = (V^{\mathcal{G}},E_d^{\mathcal{G}},E_b^{\mathcal{G}})$ , query  $Q[Y]$ , and edge weights  $W_{\mathcal{G}} = \{w_e|e\in \mathcal{G}\}$ . Let  $X = V^{\mathcal{G}}\setminus Y$  denote the set of vertices of  $\mathcal{G}$  excluding  $Y$ . We define the transformation  $(\mathcal{H},Y^{mcip}) = \mathcal{T}_2(\mathcal{G},Y)$  where  $\mathcal{H} = (V^{\mathcal{H}},E_d^{\mathcal{H}},E_b^{\mathcal{H}})$  is an ADMG and  $Y^{mcip}\subseteq V^{\mathcal{H}}$  as follows. Note that  $V^{\mathcal{H}}$  will consist of two disjoint sets of vertices, namely  $V_{top}^{\mathcal{H}}$  and  $V_{bot}^{\mathcal{H}}$ , i.e.,  $V^{\mathcal{H}} = V_{top}^{\mathcal{H}}\cup V_{bot}^{\mathcal{H}}$ .
a. Begin with  $V_{top}^{\mathcal{H}} = V_{bot}^{\mathcal{H}} = \emptyset, Y^{mcip} = \emptyset$ . For any vertex  $v \in V^{\mathcal{G}}$ , add a vertex  $v$  to  $V_{top}^{\mathcal{H}}$  with cost  $C(v) = \infty$ . If  $v \in Y$ , add  $v$  to  $Y^{mcip}$ .
b. For any directed edge  $(v_{i}, v_{j}) \in E_{d}^{\mathcal{G}}$  with weight  $w_{ij}^{d}$  in  $\mathcal{G}$ , add a new vertex  $v_{ij}^{d}$  to  $V_{top}^{\mathcal{H}}$ , with cost  $C(v_{ij}^{d}) = w_{ij}^{d}$ , where
$$
v _ {i j} ^ {d} = \left\{ \begin{array}{l l} x _ {i j} ^ {d} & \text {i f} v _ {i}, v _ {j} \in X, \\ z _ {i j} ^ {d} & \text {i f} v _ {i} \in Y \text {o r} v _ {j} \in Y, \\ y _ {i j} ^ {d} & \text {i f b o t h} v _ {i}, v _ {j} \in Y. \end{array} \right.
$$
Draw directed edges  $(v_{i}, v_{ij}^{d})$  and  $(v_{ij}^{d}, v_{j})$ . Further, draw a bidirected edge between  $v_{i}$  and  $v_{ij}^{d}$ .
c. For any bidirected edge  $\{x_i, x_j\} \in E_b^G$  with weight  $w_{ij}^b$ , add a new vertex,  $x_{ij}^b$  to  $V_{top}^{\mathcal{H}}$  with cost  $C(x_{ij}^b) = w_{ij}^b$ . Add two bidirected edges  $\{x_i, x_{ij}^b\}$  and  $\{x_j, x_{ij}^b\}$ . Further, draw two directed edges  $(x_{ij}^b, x_i)$  and  $(x_{ij}^b, x_j)$  in  $\mathcal{H}$ .
d. For any bidirected edge  $\{x_i, y_j\}$  with weight  $w_{ij}^b$ , add a new vertex  $z_{ij}^b$  to  $V_{top}^{\mathcal{H}}$  with cost  $C(z_{ij}^b) = w_{ij}^b$ . Draw bidirected edges  $\{z_{ij}^b, x_i\}$  and  $\{z_{ij}^b, y_j\}$ . Then draw a directed edge from  $z_{ij}^b$  to  $x_i$ .
e. For any bidirected edge between  $\{y_i, y_j\} \in E_b^{\mathcal{G}}$  with weight  $w_{ij}^b$  in  $\mathcal{G}$ , add a new vertex,  $y_{ij}^b$  to  $V_{top}^{\mathcal{H}}$  with cost  $C(y_{ij}^b) = w_{ij}^b$ . Draw bidirected edges  $\{y_{ij}^b, y_i\}$  and  $\{y_{ij}^b, y_j\}$ . Further, for any  $x \in X$ , draw a directed edge from  $y_{ij}^b$  to  $x$ .
f. Let  $y_{1} \prec \ldots \prec y_{k}$  denote a topological ordering among vertices of  $Y$ . For every pair  $\{y_{i}, y_{j}\}$  of vertices of  $Y$ , where  $i < j$ , add vertices  $y_{i}^{ij}, y_{i+1}^{ij}, \ldots, y_{j}^{ij}$  to  $V_{bot}^{\mathcal{H}}$ . Add  $y_{j}^{ij}$  to  $Y^{mcip}$ . Draw the directed edges  $(y_{k}, y_{k}^{ij})$  for every  $i \leq k \leq j$ . Draw the directed edges  $(y_{k}^{ij}, y_{i}^{ij})$  for every  $i < k < j$ , and the directed edge  $(y_{i}^{ij}, y_{j}^{ij})$ . Draw a bidirected edge between  $y_{j}$  and  $y_{i}^{ij}$ . Further, for any bidirected edge  $\{y_{k}, y_{l}\} \in E_{b}^{\mathcal{G}}$  where  $i \leq k, l \leq j$ , add a new vertex  $y_{kl}^{ij}$  to  $V_{bot}^{\mathcal{H}}$ , draw two bidirected edges  $\{y_{kl}^{ij}, y_{k}^{ij}\}$  and  $\{y_{kl}^{ij}, y_{l}^{ij}\}$ , and a directed edge  $(y_{kl}^{ij}, y_{ij}^{b})$ . The costs of the all of the vertices in  $V_{bot}^{\mathcal{H}}$  are infinite.
With abuse of notation, for any bidirected edge  $e_{ij}^{b} = \{v_{i}, v_{j}\} \in E_{b}^{\mathcal{G}}$  and any directed edge  $e_{ij}^{d} = (v_{i}, v_{j}) \in E_{d}^{\mathcal{G}}$ , we define  $\mathcal{T}_{2}(e_{ij}^{b}) = v_{ij}^{b}$  and  $\mathcal{T}_{2}(e_{ij}^{d}) = v_{ij}^{d}$ , respectively, where  $v_{ij}^{b}, v_{ij}^{d} \in V^{\mathcal{H}}$  are the vertices representing their corresponding edges.
We will utilize the following results to prove Proposition 4.2. More precisely, Lemmas 2 through 9 are used to prove Proposition A.10, which in turn is used to prove Proposition 4.2.
Lemma A.2. Suppose  $\mathcal{G}$  is an ADMG,  $Y$  is a set of its vertices, and  $(\mathcal{H}, Y^{mcip}) = \mathcal{T}(\mathcal{G}, Y)$ . Each vertex  $y \in Y^{mcip}$  is a district in  $\mathcal{H}$ .
Proof. It suffices to show that for every pair of  $v_{1}, v_{2} \in Y^{mcip}$  there is no bidirected edge between them in  $\mathcal{H}$ . Suppose first that  $v_{1}, v_{2} \in Y$ . Any bidirected edge between  $v_{1}$  and  $v_{2}$  in  $\mathcal{G}$  (if it exists) is removed in step (e) of the transformation, and none of the steps (a) through (f) add a bidirected edge between them. Otherwise, at least one of  $v_{1}, v_{2}$ , w.l.o.g.  $v_{1}$ , is in  $Y^{mcip} \setminus Y$ . Suppose w.l.o.g. that  $v_{1} = y_{j}^{ij}$ . From step (f) of the transformation  $\mathcal{T}$ , we know that  $v_{1}$  has bidirected edges only to vertices  $y_{kj}^{ij}$ , where none of them is a member of  $Y^{mcip}$ .
Lemma A.3. Suppose  $\mathcal{G}$  is an ADMG,  $Y$  is a set of its vertices, and  $(\mathcal{H}, Y^{mcip}) = \mathcal{T}_2(\mathcal{G}, Y)$ . Suppose there is a hedge formed for  $Q[y]$  in  $\mathcal{H}$ , where  $y \in Y$ . Let  $H$  denote the set of vertices of this hedge.  $H$  does not include any of the vertices added in the step  $(f)$  of the transformation. That is,  $H \cap V_{bot}^{\mathcal{H}} = \emptyset$ .