English 字幕

← Eulers Formula - Intro to Algorithms

埋め込みコードを取得する
3言語

Showing Revision 2 created 05/25/2016 by Udacity Robot.

  1. Let's take a look at Euler's formula again.
  2. What we're going to do is prove by induction that this holds.
  3. We can build any planar graph by iteratively adding nodes and edges.
  4. Let's start off with the simplest thing, which is just a single node. Ta-da!
  5. We can start off with just the simplest graph of all--just a node sitting on the plane all by itself,
  6. a lonely point, and we've got one node, no edges, and one giant region around it,
  7. and 1 - 0 + 1 is indeed 2.
  8. That's our base case.
  9. Now we proceed by induction.
  10. Given that we're doing a proof by induction, we're going to assume that we have
  11. some planar graph and that Euler's formula holds for that graph.
  12. We have already that n - m + r = 2.
  13. What we're going to do is we're going to add to this graph so that it's still planar
  14. and see what happens to this formula.
  15. There are two different ways that we can add to this graph.
  16. We can add a node and an edge together, or we can add an edge between two exiting nodes.
  17. Let's consider this first case where we had a new node and an edge between them,
  18. and it's still a planar graph. What happens to m, n, and r?
  19. Well, we have one new node and one new edge but the number of regions hasn't changed.
  20. We're just jutting into some region inside or outside,
  21. but it doesn't change the total number of regions--(n + 1) - (m + 1)--
  22. these ones cancel, and we get n - m + r,
  23. which by our inductive hypothesis we said is 2.
  24. In that case, the formula still holds.
  25. What about the case where we just add an edge.
  26. One way we can add an edge is inside of some other region,
  27. and let's look what happens in that case.
  28. The number of nodes is unchanged. The number of edges has gone up by one.
  29. But the number of regions has gone up by one as well.
  30. This used to be one giant region, and it's now been split in to two regions.
  31. Once again, these ones cancel.
  32. Our formula still holds.
  33. Let's just double-check what happens if we do something on the outside,
  34. sort of breaking into the huge vast region around it.
  35. Connect, say, these two nodes, what have we done?
  36. We still have the vast region around it, but we created a new region here.
  37. Again, the number of regions has gone up by 1.
  38. Similarly, if we click this over the number of regions has gone up by 1.
  39. If we add an edge without a corresponding node, the number of regions goes up by 1.
  40. If we add an edge and a node together, the region stays the same,
  41. but the number of nodes goes up by 1.
  42. No matter what you do, this formula keeps holding. Pretty cool.