I have been staring at a bayesian net for an hour and can't understand why this is correct to write:
$$P(A|B,E)\cdot P(W|A) = P(W,A|B,E)$$
Note that the joint probability of $P(A,B,E,W,R)$ can be decomposed as follows according to the bayesian net structure:
$$P(A,B,E,W,R) = P(B)\cdot P(E)\cdot P(A|B,E)\cdot P(R|E)\cdot P(A|B,E)\cdot P(W|A)$$
The definition of conditional probability gives us:
$$P(W\mid A,B,E) = \dfrac{P(W,A\mid B,E)}{P(A\mid B,E)}.$$
Given $A$, we know $W$ is conditionally independent of both $B$ and $E$, so $P(W\mid A,B,E) = P(W\mid A)$. With this, and re-arranging, we get
$$P(A\mid B,E)\cdot P(W\mid A) = P(W,A\mid B,E).$$