Structure-Preserving Rearrangements: Algorithms for Structural Comparison and Protein Analysis