Trees

An undirected graph on vertices which is connected and has no cycles is called a tree

Any two of the following three properties imply the third one:

  • has edges
  • has no cycles
  • is connected

Max

Given an undirected graph on vertices, find a set of maximum size such that no vertices in form an edge of .

Obtaining a recurrence

Root the given tree at an arbitrary vertex, say .
For each vertex , we use the following notation:

  • is the subtree of which is rooted at
  • is the size of maximum independent set for the tree
  • is the set of children of
  • is the set of grandchildren (children of children) of .

Final answer is where is the root.

Correctness:

  • If is in the independent set, then none of its children can be in the independent set
  • If is not in the independent set, then (potentially) all of its children can be in the independent set

Running time

  • The array has entries
  • Filling up a new entry in the array needs to look-ip existing entries from the array, and do additions & one max operation
    • This needs time
  • Hence, time required to fill up all entries in the array is = ( entries time to complete each entry)
  • Can be improved to running time by a more careful analysis.