Let $G(V,E)$ be a symmetric graph with $n$ vertices and $m$ edges that has a $2\text{-factor}$ with edge set $F$, i.e. $F$ are the edges of an undirected vertex-disjoint cycle cover of $G$.


**Question:**  

given only $F$ represented as an unordered sequence $\big( (u\_1,v\_1),\,\dots,\,(u\_n,v\_n)\big)$, what is the complexity of determining a permutation of the $n$ vertices that has the same cycles as $F$, i.e. storing the vertices in an array $\boldsymbol{a}$ such that $(i,\boldsymbol{a}[i])\in F$



Reconstructing a 2-factor from its edge set
Construct an undirected graph on the edge set $F$. This graph has each vertex with even degree, i.e. it's an Eulerian graph. Construct an Eulerian cycle in each connected component, e.g. following the [Hierholzer's algorithm](https://en.wikipedia.org/wiki/Eulerian_path#Hierholzer%27s_algorithm), which takes linear time in $|F|$. Fix any orientation of these cycles, and impose it on the edges from $F$.


