Reputation: 1058
I am thinking of easiest way to check if two vertices (edge) is a bridge in unidirected graph G? My graph is represented by adjecency list.
Upvotes: 0
Views: 82
Reputation: 10595
(The easiest to understand isn't necessarily the best way.)
Run DFS and count the number of components. Remove the edge and run the DFS again. If the number of components increased, that was a bridge.
Upvotes: 1