The code is a (good, in my opinion) implementation of a segmentation engine based on normalised cuts (a spectral clustering algorithm) and a pixel affinity matrix calculation algorithm, that accounts for texture and colour similarity.
The code implements the methods described in the following papers:
# C. Fowlkes, D. Martin, J. Malik. "Learning Affinity Functions for Image Segmentation: Combining Patch-based and Gradient-based Approaches", CVPR, Madison, WI, (June 2003).
# D. Martin, C. Fowlkes, J. Malik. "Learning to Detect Natural Image Boundaries Using Local Brightness, Color and Texture Cues", TPAMI 26 (5) p.530-549
# C. Fowlkes, J. Malik. "How Much Does Globalization Help Segmentation?", Technical Report CSD-04-1340, Division of Computer Science, University of California, Berkeley, (July 2004).