Heaps, graphical models, and random walk representations