0

Here is the Context to my question:

I have a homework question: Describe a linear time algorithm in the size of the vertices (ie O(|V|)) to determine if there is a max clique in a graph where all the vertices have a max degree of size 3. I know that there is a polynomial time algorithm to do this. What I'm struggling to come up with is an O(|V|) algorithm to do this. Also, I do realize that the largest a clique could be is of size 4.

Here is where I keep getting stumped:

It seems to me that at some point along the way you would need to enumerate all k-tuples of size 4. But how can this be done in O(|V|) time?

Also of note, is that I have tried playing around with dynamic programming to solve this, but I fail to see how to do this in linear time.

Answers, thoughts, suggestions?

user678392
  • 1,981
  • 3
  • 28
  • 50
  • Hint: Every clique is a subset of the neighbourset of some vertex. – tmyklebu Apr 13 '13 at 20:48
  • When you say "max" clique, I assume you mean maximal, not maximum, correct? – G. Bach Apr 13 '13 at 20:50
  • @G.Bach The homework writer wouldn't have specified a degree bound if they had meant maximal. – David Eisenstat Apr 13 '13 at 20:56
  • @DavidEisenstat Oh I just realized I misread the question, I had thought it said "minimum vertex degree". Still, this doesn't change the difference; in graphs with maximum vertex degree 3, there can still be maximal cliques that are not maximum cliques. – G. Bach Apr 13 '13 at 20:58

1 Answers1

0

Finding every k-tuple in O(|V|) time is not possible because the desired output is larger than the complexity you want to achieve. But actually, finding a max-clique doesn't require you to find all k-tuples. The only k-tuples you have to consider are the one that forms a neighbourhood of some vertex (including the vertex itself).

Thomash
  • 6,339
  • 1
  • 30
  • 50
  • First, as stated this answer doesn't help me. (It's me, not you.) Preferably, I would like a rephrasing of the answer. If not, could you at least say what the last sentence means. Lastly, I don't see how you can find every 4-tuple in O(V) time. To see why I am struggling this, I don't see how to find all 2-tuples in linear time (but can do this in quadratic time.) If I can't do 2-tuple in linear time, what chance do I have of find 4-tuple in O(|V|) time? – user678392 Apr 13 '13 at 22:26
  • @user678392 The neighbourhood of a vertex v is defined as the set S such that for all s in S, there is an edge {v,s}; so in simpler words: the neighbourhood of v is the set of all vertices that are adjacent to v. Any v can only form a clique with the vertices from its neighbourhood. Also, if by 2-tuple you actually do mean sets of vertices such that the set has exactly 2 vertices and the set forms a clique, then all 2-cliques of any graph are exactly the edges. – G. Bach Apr 13 '13 at 23:02
  • @G.Bach I'm sorry but I don't see how this helps me. How do I find every 3 tuple in linear time? – user678392 Apr 15 '13 at 05:04
  • @Thomash I don't understand this statement: "The only k-tuples you have to consider are the one that forms a neighbourhood of some vertex (including the vertex itself)." How does this help? – user678392 Apr 15 '13 at 05:05
  • @user678392 Take a vertex x of degree three; call its neighbours u,v and w. Which edges does the graph have to have in order for (x,u,v,w) to be a clique? How many operations do you need to check that? – G. Bach Apr 15 '13 at 10:15
  • @G.Bach Well, it seems like a lot. Because each vertex might have different degrees and we are could be looking at cliques of size 1-4, depending on the parameter. – user678392 Apr 17 '13 at 19:42
  • @user678392 Think about this: which edges would you have to check in order to verify whether x is part of a 4-clique or a 3-clique, if the neighbourhood of x is {u,v,w}? 2-cliques are just edges, so those are trivial. – G. Bach Apr 17 '13 at 20:16
  • @G.Bach 4 clique: x,u,v,w. You have to go each vertex and see if its adjacent edges plus itself is x,u,v,w. But with 3, you have might still have vertices of degree 3. So you have to look at the pairs of adjacent vertices in order to answer the problem. – user678392 Apr 17 '13 at 20:29
  • @user678392 Alright, and for the presence of how many edges do you have to check? Does that number increase with the size of the graph, provided that the maximum degree doesn't exceed 3? – G. Bach Apr 17 '13 at 20:35
  • @user678392 So if it's a constant number, it doesn't add to the complexity. – G. Bach Apr 17 '13 at 20:44
  • @G.Bach yes, but we are looking at vertices more than once. So how can I show that the algorithm is still O(V)? – user678392 Apr 17 '13 at 21:02
  • Iterate over the vertices, for each vertex check its neighbourhood for a maximal clique; this takes constant time per vertex, so you only have complexity O(|V|). – G. Bach Apr 17 '13 at 21:04