DAA

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

DAA

Biconnected Components and DFS


Articulation Points
• Definition: A vertex v in a connected graph G is an articulation point if removing v
and all edges incident to it disconnects G into two or more non-empty components.
Biconnected Graphs
• A graph is biconnected if it contains no articulation point.
Applications
• In communication networks, articulation points represent critical nodes whose
failure would disconnect the network.
Identifying Articulation Points
• A depth-first spanning tree (DFS tree) is used to identify articulation points
efficiently.
• Definitions:
o Tree Edges: Edges in the DFS tree.
o Back Edges: Edges not in the DFS tree that connect a vertex to its ancestor.
o Depth First Numbers (dfn): The order in which vertices are visited in DFS.
o Low Values (L): The smallest dfn reachable from a vertex using descendants
and at most one back edge.
Key Lemmas
1. Root Node Rule: The root of a DFS tree is an articulation point if it has at least two
children.
2. Other Nodes Rule: A non-root vertex u is an articulation point if it has a child w such
that L[w]>dfn[u].

Pseudocode: Finding dfn and L


Algorithm Art(u, v):
1. Assign dfn[u] = num; L[u] = num; num++;
2. For each vertex w adjacent to u:
- If w is unvisited, call Art(w, u) recursively and update L[u] = min(L[u], L[w]).
- If w ≠ parent(v), update L[u] = min(L[u], dfn[w]).
Biconnected Components
• Definition: Maximal subgraphs of G that are biconnected.
• Properties:
o Two biconnected components can share at most one vertex (an articulation
point).
o Each edge belongs to only one biconnected component.
Algorithm to Identify Biconnected Components
• Use a stack to store edges during DFS traversal.
• For an articulation point u, all edges in the subtree rooted at w (where L[w]>dfn[u])
form a biconnected component.
Pseudocode:
Algorithm BiComp(u, v):
1. Assign dfn[u] = num; L[u] = num; num++;
2. For each vertex w adjacent to u:
- Push edge (u, w) onto the stack.
- If w is unvisited, call BiComp(w, u) recursively.
- If L[w] > dfn[u], output edges from stack until (u, w) is removed.
- Update L[u] = min(L[u], L[w]).
- If w ≠ parent(v), update L[u] = min(L[u], dfn[w]).
Complexity
• DFS traversal and articulation point identification: O(n+e), where n is the number of
vertices and e is the number of edges.
• Biconnected component detection: O(n+e).
Theorem
• Algorithm 6.10 correctly generates the biconnected components of GGG for n≥2n
\geq 2n≥2.
Connected Components and Spanning Trees
Determining Connected Components Using BFS
• For a connected undirected graph GGG, all vertices can be visited with a single call to
BFS.
• If GGG is not connected, multiple BFS calls are needed to visit all vertices.
• BFS can be used to identify whether GGG is connected.
• Newly visited vertices in a BFS call correspond to a connected component.
• By modifying BFS to store visited vertices in a list, the subgraph formed by these
vertices represents a connected component.
• Using adjacency lists, BFS computes connected components in O(n+e) time.

Reflexive Transitive Closure Matrix


• Reflexive transitive closure matrix A∗A^*A∗ of an undirected graph GGG can be
derived using BFS.
• A∗(i,j)=1A^*(i, j) = 1A∗(i,j)=1 if i=ji = ji=j or i≠ji \neq ji =j and vertices iii and jjj belong
to the same connected component.
• An array connec[i] can store the connected component index for each vertex iii,
calculated in O(n+e)O(n + e)O(n+e) time.
• A∗A^*A∗ can be computed in O(n2)O(n^2)O(n2) time and O(n)O(n)O(n) space
(excluding A∗A^*A∗) using adjacency lists or matrices.
Spanning Trees Using BFS
• Definition: A spanning tree of a graph GGG is a subgraph that includes all vertices of
GGG and is a single connected tree.
• A spanning tree exists iff GGG is connected.
• BFS identifies the forward edges used to visit unvisited vertices, forming the set ttt of
forward edges.
• If GGG is connected, ttt forms a breadth-first spanning tree.
• Example: In a connected graph, ttt includes n−1n-1n−1 distinct edges, creating a tree.
Theorem 6.4: BFS-Based Spanning Tree Construction
• Modifying BFS (denoted as BFS*) to collect edges (u,w)(u, w)(u,w) into ttt ensures ttt
forms a spanning tree if GGG is connected.
• Proof:
1. BFS visits all nnn vertices if GGG is connected.
2. The set ttt contains n−1n-1n−1 edges, all distinct.
3. ttt defines a connected graph with n−1n-1n−1 edges and nnn vertices,
forming a tree by definition.
Spanning Trees Using DFS
• Depth-First Traversal (DFT) can also be used to compute connected components and
the reflexive transitive closure matrix of a graph.
• Modifying DFS by adding edges to ttt during traversal produces a depth-first
spanning tree.
• Example: For a graph, the DFS spanning tree may include different edges compared
to the BFS spanning tree.
BFS vs. DFS for Spanning Trees
• Both BFS and DFS are equally effective for determining connected components,
reflexive transitive closures, and spanning trees.
• The choice between BFS and DFS depends on specific traversal requirements.

Cook's Theorem
Cook's Theorem is a fundamental result in computational complexity theory, proved by
Stephen Cook in 1971. It established the concept of NP-completeness and showed that
certain computational problems are as "hard" as any other problem in the class NP.

Statement of Cook's Theorem


"The Boolean satisfiability problem (SAT) is NP-complete."
This means:
1. SAT is in NP:
o Given a Boolean formula and an assignment of truth values to its variables,
we can verify in polynomial time whether the assignment satisfies the
formula.
2. SAT is NP-hard:
o Any problem in the class NP can be reduced to SAT in polynomial time.
What is the SAT Problem?
• SAT (Boolean Satisfiability) is the problem of determining whether there exists an
assignment of truth values (true or false) to variables in a Boolean formula such that
the formula evaluates to true.
• Example Boolean formula in Conjunctive Normal Form (CNF):

The goal is to determine if there is an assignment of x1,x2,x3 that makes the entire
formula true.

Implication of Cook's Theorem


• Since SAT is NP-complete, if we can solve SAT efficiently (in polynomial time), we can
solve any NP problem efficiently.
• This result implies that all NP-complete problems are polynomial-time reducible to
each other.

Steps in Proving Cook's Theorem


1. Show SAT is in NP:
o Verifying a solution to a SAT problem can be done in polynomial time by
evaluating the formula.
2. Polynomial-time Reduction:
o Show that any problem in NP can be transformed (reduced) into an instance
of SAT in polynomial time.
o This is done by expressing the computation of a Non-deterministic Turing
Machine (NTM) as a Boolean formula.

Significance
• Foundation of NP-Completeness: Cook's Theorem laid the groundwork for
identifying other NP-complete problems (e.g., Traveling Salesman Problem, 3-SAT,
Graph Coloring).
• P vs NP Problem: If anyone finds a polynomial-time solution for SAT, it would mean
P=NP, solving one of the biggest open problems in computer science.

Conclusion
Cook's Theorem shows that solving the SAT problem efficiently would mean solving all NP
problems efficiently. This theorem has far-reaching implications for computer science,
cryptography, and optimization.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy