1 / 6

Largest Independent Set

Largest Independent Set. INDEPENDENT SET : Given a graph G = (V, E) what is the largest subset of vertices S  V such that each edge of E has Ex. Is there an independent set of size  6? Yes. Ex. Is there an independent set of size  7? No. independent set.

gbarrios
Download Presentation

Largest Independent Set

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Largest Independent Set • INDEPENDENT SET: Given a graph G = (V, E) what is the largest subset of vertices S  V such that each edge of E has • Ex. Is there an independent set of size  6? Yes. • Ex. Is there an independent set of size  7? No. independent set

  2. Largest Independent Set • Intractable problem for general graphs • What happens when the graph G is a tree T=(V,E)?

  3. Largest Independent Set • Select a root r for T • For a node v in T, let T(v) be the subtree of T rooted at node v r r v

  4. Dynamic Programming Equation • OPT(v): Largest independent set forT(v) • We are interested in OPT(r)

  5. Algorithm IS(v) If v has no children M[v]=1 ElseIf M[v] is empty SomaFilhos0;SomaNetos1 Para todo filho w de v SomaFilhos <= SomaFilhos+ IS(w) Para todo neto w de v SomaNetos <= SomaNetos+ IS(w) M[v] max(SomaFilhos,SomaNetos) End if Return M[v]

  6. Análise • Cada nó é chamado no máximo duas vezes, uma vez por seu pai e outra por seu avô. • A primeira chamada tem custo proporcional ao número de filhos mais o número de netos e a segunda chamada custa O(1) . Somando o custo de todas as chamadas obtemos O(|V|)

More Related