Discrete Structures

Lecture Notes, 8 Dec 2010

Last Update: 8 December 2010

Note: NEW or UPDATED material is highlighted

Note: A username and password may be required to access certain documents. Please contact Bill Rapaport.

Index to all lecture notes
…Previous lecture

§9.6, esp. pp. 653–655
§9.8, esp. p. 668;
§4.3(!), esp. p. 302;
§10.1, esp. p. 685–686:

Graphs (cont'd) and Rooted Trees

  1. The Traveling Salesman Problem (TSP) is "NP":

    1. ∃ no known algorithm for solving it in Polynomial time
      by a deterministic Turing Machine (e.g., your laptop)

      • A problem is computable in P-time
        in the worst case, the time it takes to compute a solution for it
        on a deterministic Turing Machine
        is a polynomial function of the size of its input n.

        • i.e.) time is no worse than aknk + ak–1nk–1 + … + a1n + a0,
          for some integer k and real constants ai

        • e.g.) exponential time (order of 2²) is not in P

    2. It can only be computed in Non-deterministic Polynomial time

      • i.e.) solvable in polynomial time by a non-deterministic TM

        • A non-deterministic TM
          a TM that does all possible "next steps" simultaneously until it finds a solution.

      • hence, ≡ SAT

        • SAT = finding an assignment of truth values that "sat"isfies a proposition of propositional logic

          • i.e.) computing a truth table with n atomic propositions

    3. P = NP?

      • The greatest unsolved problem of CS
      • All functions divide into:

        • those not computable even in principle
        • those that are computable
          (by a Turing Machine, or by a recursive function),
          which divide into:

          • those computable in practice
            (i.e., polynomial time, or "P")

          • those not computable in practice
            (i.e., non-deterministic polynomial time, or "NP")

      • Read Goldman's Theorem

        • (humorous novel about P=NP written by a guy I went to elementary school with :-)

    4. and TSP is NP-hard:

      • at least as hard as—and possibly harder than—any other NP problem

    5. and TSP is NP-complete:

      • if can solve it in P-time,
        then can solve all other problems in P-time

  2. The 4-Color Theorem:

    1. Thm (4CT): No map needs >4 colors

      • Convention: Two "countries" that share a linear boundary must be colored differently.

    2. How many colors does this map need?

      • It can be colored with 5 colors,
        but does it need 5?

          uses colors 1,…,5

      • No:

          only needs colors 1,…,4

    3. Can represent a map as a graph:

      • vertices represent countries;
        edges represent boundaries

    4. Then can use graph theory + a computer! to prove 4CT

      • Appel & Haken (1976) had to consider 2000 special cases
      • Univ. of Illinois postmark: "4 Colors Suffice!"

      • Does this change the nature of mathematical proof?
        (Do we need to prove that the computer program that proved 4CT was correct?)

  3. Trees & Rooted Trees:

    1. Def:

      1. E.g.)

      2. But this is not a tree (has a circuit):

      3. Nor is this (it's not connected;
        it's a "forest": a graph consisting of two (or more) trees)

      4. This "rooted", directed tree (with a "start" vertex, or "root") is a tree:

          (think of each edge as being directed "downwards")

    2. Recursive Def of "Rooted Tree":

        Base Case:

          Let r be a vertex

          Then T = ({r}, ∅)

          • (where V = {r} & E = ∅)

          isdef a rooted tree with root r

          • (∴ the base case of a rooted tree, T, is a graph with 1 vertex & no edges!)

        Recursive Case:

          Let T1, … , Tn be (a forest of) disjoint rooted trees with roots r1, … , rn

          • ("disjoint" means that their vertex sets are disjoint)

          Let r be a new vertex ≠ each ri

          Then the directed graph consisting of r with an edge from r to each ri

          a rooted tree with root r

    3. Set-Theoretical Recursive Def of Rooted Tree:

      1. Just as a test of your mathematical reading skills ;-)

      2. Base Case:

          Let r be a vertex.
          Then T = ( {r}, ∅ ) is a tree rooted at r

      3. Recursive Case:

          ∀ i ∈ {1, … , n}:

            Let ri be a vertex.
            Let Vi be a set of vertices.
            Let Ei be a set of edges.
            Let Ti = (Vi, Ei) be a tree rooted at ri.

          Let T1, … , Tn be a forest of disjoint trees (rooted at r1, … , rn).

          Let r be a vertex ≠ each ri.

          Tn+1 = ( Vn+1 = i∈{1,…n}Vi ∪ {r},

                      En+1 = i∈{1,…n}Eii∈{1,…n}{(r,ri)} )

          is a tree rooted at r.

    4. E.g.)

        T1 = • r1

        T2 = • r2

        T3 = • r3

          are rooted trees with roots ri by the base case.

        T4 =

        is a rooted tree with root r4 by the recursive case
        (and T1, T2, T3 are subtrees of T4)

        and if T5 =

        is a rooted tree with root r5,
        then T7 =

        is a rooted tree with root r7

    5. Terminology for Rooted Trees:

      1. Recall that a rooted tree is a digraph!
      2. Consider this rooted tree:

        Then here is the "feminist"/"male chauvinist"/neutral terminology:

      3. "a" is the mother/father/parent of "b" and "c"
      4. "b" is a daughter/son/child of "a"
      5. "b" and "c" are sister/brother/sibling vertices
      6. "b" and "d" are descendants of "a"
      7. "a" is an ancestor of "b",…,"e"

        and, switching metaphors:

      8. "a" is the root
      9. "d", "e", and "c" are leaves
      10. "b" is the root of a subtree with leaves "d" and "e"

Next lecture…

Text copyright © 2010 by William J. Rapaport (rapaport@buffalo.edu)
Cartoon links and screen-captures appear here for your enjoyment. They are not meant to infringe on any copyrights held by the creators. For more information on any cartoon, click on it, or contact me.