How do Graphical Models work in practice? I know how graphical models work at a high level. I have knowledge about graphs in general, but the message passing is hard to understand and implement. I want to be able to understand what is going under the hood rather than use an existing library, so that I may be able to use graphical models in applications where they are not usually used. I have checked out some source code, but it was unclear as to what was happening.
Does anyone have an intuitive, and programmatic explanation as to how message passing works? Anything helps.
Thanks.
 A: Here is an extract from a work that may assist, to quote:

... message passing models provide a clean separation between modeling and inference, learning these models with approximate inference is not well understood. Furthermore, even if a good model is learned, predictions are often inaccurate due to approximations. In this work, instead of performing inference over a graphical model, we instead consider the inference procedure as a composition of predictors. Specifically, we focus on message-passing algorithms, such as Belief Propagation, and show how they can be viewed as procedures that sequentially predict label distributions at each node over a graph. Given labeled graphs, we can then train the sequence of predictors to output the correct labelings. The result no longer corresponds to a graphical model but simply defines an inference procedure, with strong theoretical properties, that can be used to classify new graphs.

And more comments on graphical models:

Graphical models provide a natural way of encoding spatial dependencies and interactions between neighboring sites (pixels, superpixels, segments, etc.) in many computer vision applications such as scene labeling (Fig. 1). A graphical model represents a joint (conditional) distribution over labelings of each site (node), via a factor graph (a bipartite graph between output variables and factors) defined by a set of variable nodes (sites) V , a set of factor nodes (potentials) F and a set of edges E between them:

My rough understanding in two words, 'Belief Propagation', which is a  message-passing algorithm. So, if something resembles a house (the belief), this gives clues to 'predict label distributions at each node over a graph', for things like windows,...
