Presentation is loading. Please wait.

Presentation is loading. Please wait.

Bridges and Articulation Points

Similar presentations


Presentation on theme: "Bridges and Articulation Points"— Presentation transcript:

1 Bridges and Articulation Points

2 Articulation Points Is a node u of a graph such as if you remove u from the graph then the number of components increases 3 components 1 component

3 Articulation Points u is an articulation point if
u isn't a root and there exists one of its subtrees that has no back edges for an ancestor of u u is root and has more than 2 children p u Right Wrong The second and third subtree all have back edges to p (an ancestor of u), while the first one hasn't, therefore u is an articulation point (notice that if you remove it, the first subtree will be disconnected from the rest of the graph).

4 Bridges Is an edge uv of a graph such as if you remove uv from the graph then the number of components increases 2 components 1 component

5 Bridges uv is a bridge if and only if it doesn't belong to a cycle.
Proof uv is a bridge => doesn't belong to a cycle uv doesn't belong to a cycle => uv is a bridge u v u v uv is not in a cycle so if uv is removed there is no other way to get from u to v, so you are cutting the graph into 2 components (one with u and another with v) If you remove uv there is another path that takes from u to v (the graph is still connected), so uv is not a bridge

6 Bridges The definition on the previous slide gives us that:
uv is a bridge ⇔ there is no back edge from a descendant of u to an ancestor of u uv is a bridge => there is no back edge... uv doesn't have a back edge... => uv is a bridge u u v v Assume that uv is not a bridge, then once it’s removed it must have a path between u and v, but we are assuming that there is no back edge, contradiction. Assume that there is a back edge, then uv is part of a cycle and by the previous slide this is a contradiction

7 Interesting fact If you remove a bridge of a graph the number of components increases by exactly one but if you remove an articulation point the number of components can increase by more than one.

8 Naïve Implementation (not optimal)
Find a vertex or an edge that when removed will disconnect the UNDIRECTED graph Calculate the number of connected components Try, one-by-one, removing each edge/vertex Recalculate number of CCs If more CCs, then it’s an articulation point or bridge.

9 A better approach Compute DFS, but also store two values per node:
d: the order in which the node was reached during DFS Low: smallest d reachable from current subtree At a vertex, the Low value is the lowest of: Your own value (obviously, you can reach yourself) Any back edge The lowest returned from a recursive call on all children Notice: it does NOT include the parent If a neighbor vertex has a Low value greater or equal to your own d, then you’re at an articulation point Root node is special: it is an articulation point iff there are 2 (or more) children not part of the same branch (i.e. if during DFS, it has to start recursive calls on at least 2) If Low(u) > d(v), then u-v is a bridge Likewise, if Low(v) > d(u), then u-v is a bridge

10 How to implement? d[v] = time instant that you enter a node
low[v] = the smallest d that v can reach through its descendants (including v itself) Example: d[a] = 1 d[b] = 2 d[c] = 3 d[d] = 8 d[e] = 4 d[f] = 7 d[g] = 5 d[h] = 6 low[a] = 1 low[b] = 1 low[c] = 1 low[d] = 8 low[e] = 3 low[f] = 2 low[g] = 3 low[h] = 6 u is an articulation point if low[v] >= d[u] for some children v uv is a bridge if low[v] > d[u] for some children of v Notice that low[e] = 3 and not 1 Notice that a has 2 children (b and c), but they are connected, so only 1 is a “child” in the DFS search tree a b c d e f g h

11 d Low 1 2 d is when visited Low is lowest seen in that subgraph 7 3 6 9 4 3 8 5 3

12 d Low 1 2 Articulation point if neighbor has a low value >= your d 7 3 6 9 4 3 8 5 3

13 d Low 1 2 Bridge if Low(u) > d(v) for some edge u-v 7 3 6 9 4 3 8 5 3


Download ppt "Bridges and Articulation Points"

Similar presentations


Ads by Google