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
alloc costs O(v)
dfs_helper costs O(e)
free costs O(1)
together O(v+e)
but if you use hashset or with sparse graph, they cost O(e)
Costs: O(v^2)
remember to free queue, mark array
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))
Table of Content