Exact or approximate inference in graphical models: why the choice is dictated by the treewidth, and how variable elimination can be exploited