Let $x$ be a binary random variable and $z$ be an arbitrary random variable. $x$ and $z$ are, in general, not independent.
Let $y_1, \ldots y_n$ be $n$ identically distributed binary random variables conditionally independent given $z$.
A graphical model would have $x$ at the root, pointing to $z$, and $z$ pointing to each of the $y_i$.
Consider random variable $c = \sum y_i$ and function $f(k) = p(x=1|c=k)$ defined from $k=0$ to $n$.
How many local extrema can $f$ have, at most?