Fixed Length Cycle Search

116 Views Asked by At

I am given a list of $0 \le M \le 2n(n-1) $ edges of a graph. My goal is to find a connected subgraph of this graph such that the degree of every vertex in the subgraph is $n$ that has exactly $n$ vertices (aka a totally connected subgraph where every vertex shares an edge with every other). I am not exactly how to do this quickly but a starting point was to find a cycle of length $n$ since if such a subgraph exists it must have a cycle among all the vertices. At which point it is easy to check if each vertex is connected to every other.

So the problem reduces to:

given $0 \le M \le 2n(n-1) $ edges of a graph find a cycle of exactly length $n$. At this point I don't know where to proceed.

I should mention something else:

there are $ 0 \le q \le 2n$ vertices in the original graph.


I want to be able to confirm whether such a subgraph or cycle exists in polynomial time