English subtitles

← Reducing to Clique - Intro to Algorithms

Get Embed Code
3 Languages

Showing Revision 3 created 05/24/2016 by Udacity Robot.

  1. Just to illustrate this example, imagine we'd start up with some graph H. It's a little bit of a mess.
  2. There's a lot of edges in here but we're going to do is convert this to a new graph G,
  3. which is the complement of H, and so every place in H where there is an edge we leave the edge out,
  4. and every place where there is not an edge, we add an edge.
  5. For example, this node is not connected to this one or this one.
  6. So in the complement graph, we connect it that one and that one.
  7. This node is connected to three on the top, one on the bottom.
  8. So we connect it to this one on the top and these two on the bottom.
  9. This one on the top and these two in bottom.
  10. So we carefully constructed this complement graph G and the thing that you need to realize now is that
  11. G, this new graph, which is the complement of H has an S-clique
  12. if and only if H has an S independent set.
  13. In fact, it's the same set of nodes. So here's our four clique for example.
  14. This is similar to the graph that we looked at before.
  15. This is our four clique in G and if we look that corresponds exactly to a four independent set in H
  16. because it has all the pairwise edges in G and then it has to fail to have all those pairwise edges in H.
  17. So that's how can use the solution into the clique problem to solve the independent set problem.
  18. Now in this particular example, well it illustrates a general idea
  19. which is we take instances of one problem and we transform them into instance of another.
  20. In this case the transformation is really very straightforward.
  21. Maybe it wasn't obvious to you at first. Now that I putted that, it's probably pretty straightforward.
  22. Some of these reduction actually can be much more involved.
  23. This one actually is also really easily reversed.
  24. So if we have an algorithm for independent set.
  25. We can use that to solve the clique problem the same way.
  26. Invert the graph where I complement the graph, look for the independent set and that tells us
  27. what the clique is in the original graph,
  28. but sometimes again the connection is not always so straightforward.