# Factorization of a joint density over a directed graph

Let $G = (V,E)$ be a directed acyclic graph.

Let $i \rightarrow j$ be an edge such that the parents of $j$ are exactly:

• the parents of $i$,
• and $i$.

Let $L\left(G \right)$ be the set defined by {a vertex and its parents, for all vertices in $G$}

Let $G' = (V,F)$ where $F$ is $E$ with $j \rightarrow i$ instead of $i \rightarrow j$.

Given a set of random variables $(X_{v})_{v \in V}$ for which the joint density can be factorized over $L\left(G \right)$, I would like to show that the joint density could also be factorized over $L\left(G' \right)$.

Let $P$ be the parents of $i$ in the graph $G$, thus the parents of $j$ in the graph $G'$.

So I would like to show that there exists $g_{i}$ and $g_{j}$ such that: $g_{i}(x_{i},x_{j},x_{P}) \times g_{j}(x_{j},x_{P}) = f_{i}(x_{i},x_{P}) \times f_{j}(x_{i},x_{j},x_{P})$.

I am unsure whether I could just consider that there was a swap of $i$ and $j$, and I could take $g_{i}=f_{j}$ and $g_{j}=f_{i}$. Or maybe, there is something to do with conditional probabilities and Bayes formula.