This paper presents an efficient algorithm for image segmentation and a framework for perceptual grouping. It makes an attempt to provide one way of combining bottomup and top-down approaches. In image segmentation, it generalizes the Swendsen-Wang cut algorithm [1] (SWC) to make both 2-way and m-way cuts, and includes topology change processes (graph repartitioning and boundary diffusion). The method directly works at a low temperature without using annealing. We show that it is much faster than the DDMCMC approach [12] and more robust than the SWC method. The results are demonstrated on the Berkeley data set [7]. In perceptual grouping, it integrates discriminative model learning/computing, a belief propagation algorithm (BP) [15] , and SWC into a three-layer computing framework. These methods are realized as different levels of approximation to an “ideal” generative model. We demonstrate the algorithm on the problem of human body configuration.