Lecture 024

Graph Connectivity

Connected (reachable) Connected Component: maximal set of vertices that are connected (connected individual graph)

Search Problem: finding a witness (more complex, for cryptography) Verification Problem: checking a witness

Definition of Reachable

Definition of Reachable

Depth First Search with Adjacency List

Bad DFS that has infinite loop

Bad DFS that has infinite loop

Fixing DFS using mark array

Looper

Looper

Heap header

Heap header

Implementation with Adjacency Matrix

Costs: O(v^2)

Breath First Search

BFS using queue

BFS using queue

If we use queue: breath first If we use stack or other: depth first If we use priority: A* heuristic (but insertion and removal from priority queue is not O(1))

Cost of DFS, BFS for List and Matrix

Cost of DFS, BFS for List and Matrix

Table of Content