I am terrible at these kinds of discrete math problems, so I am asking here the following problem: Given a connected graph $G$ with vertices V[i], find an ordering P of its vertices such that there exists an edge between V[P] and V[P], and there is an edge between V[P] and V[P], etc. Basically, the ordering should be such that each successive pair of vertices in the ordering are connected by an edge. Assume that a solution exists. I just need some algorithm to solve this problem, and it doesn't even necessarily have to be all that efficient since the graph will have at most something like 30 vertices.
For the curious: the context of this problem is in generating the ordering of indices of a sparse matrix to guarantee the existence of a block 2x2 LDL^T factorization. The graph corresponds to the non-zero pattern of a diagonal-block of the matrix with zero diagonal, and I need to guarantee that all the 2x2 blocks are full rank.