Connectivity in Graphs
st-CON
Given: A directed graph
Return: YES if
STRONG CONNECTIVITY
Given: A directed graph
Return: YES if
Depth First Search on Graphs
(this algorithm assumes the graph is represented as out lists)
begin DFS(G, v)
mark v
for each w in G.edges(v) do
if w unmarked
DFS(G, w)
- DFS solves st-CON and with some nuance STRONG CONNECTIVITY
- This algorithm runs in linear time. Easy way to see that is that every edge is processed once.