Implemented function to get the full joint space for a set of variables needed for marginalization and product of factors.