I have a circular data structure that has a reading direction and a starting point. (Internally it could be a directed graph, linked list or just an array that gets rotated using modulo.) I want to have a way to normalize the starting point of the data structure in a way that the same data input yields the same starting point.
A = [1,2,3]
B = [2,3,1]
C = [3,1,2]
assert(Normalized(A) == Normalized(B))
assert(Normalized(B) == Normalized(C))
I don't care so much about a specific rotation. (Just, of corse, the circular order and direction needs to be persisted :P )
Here is a cool answer about comparing circular structures: Interview question: Check if one string is a rotation of other string
[EDIT: Removed non-working approach]
I feel, that smart people thought about this before. What is the terminology I am missing or what are known algorithms for normalizing the rotation of circular data structures?