1 / 29

Graph (III)

Graph (III). Trees, Articulation point, Bridge, SCC. GGuy 19-3-2011. Review. Shortest path Dijkstra Bellman Ford Floyd Warshall Minimum Spanning Tree Prim’s Kruskal’s. Tree. The following four conditions are equivalent: G is connected and acyclic

nituna
Download Presentation

Graph (III)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Graph (III) Trees, Articulation point, Bridge, SCC GGuy 19-3-2011

  2. Review Shortest path Dijkstra Bellman Ford Floyd Warshall Minimum Spanning Tree Prim’s Kruskal’s

  3. Tree • The following four conditions are equivalent: • G is connected and acyclic • G is connected and |E| = |V| - 1 • G is acyclic and |E| = |V| - 1 • Between any pair of vertices in G, there exists a unique path • G is a tree if at least one of the above conditions is satisfied

  4. Tree • |E| = |V| - 1 • Between any pair of vertices, there is a unique path • Adding an edge between a pair of non-adjacent vertices creates exactly one cycle • Removing an edge from the tree breaks the tree into two smaller trees

  5. ancestors root parent siblings descendants children Tree

  6. Tree Diameter Find the farthest node from root, say it u Find the farthest node from u, say it v (u, v) = Tree diameter

  7. DFS Tree DFS (vertex u) { mark u as visited time = time + 1 birth[u] = time; for each vertex v directly reachable from u if v is unvisited parent[v] = u DFS (v) time = time + 1 death[u] = time; }

  8. A D B E G E F C A D H F unvisited B visited visited (dead) C G H DFS forest (Demonstration) 1 2 3 13 10 4 14 6 12 9 8 16 11 5 15 7 - A B - A C D C

  9. A D B E G C F H Classification of edges • Tree edge • Forward edge • Back edge • Cross edge • Question: which type of edges is always absent in an undirected graph?

  10. Determination of edge types • How to determine the type of an arbitrary edge (u, v) after DFS? • Tree edge • parent [v] = u • Forward edge • not a tree edge; and • birth [v] > birth [u]; and • death [v] < death [u] • How about back edge and cross edge?

  11. Determination of edge types

  12. Articulation Point For a undirected graph G, Node u is an Articulation Point if remove u from G will create more components.

  13. Articulation Point

  14. Bridge For a undirected graph G, Edge (u, v) is an bridge if remove (u, v) from G will create more components.

  15. Bridge

  16. Finding AP and Bridge DFS(vertex u) time = time + 1 low[u] = vis[u] = time for each vertex v directly reachable from u if v is not visited DFS(v) low[u] = min(low[u], low[v]) if v is visited and parent of u is not v low[u] = min(low[u], vis[v])

  17. Finding AP Find the DFS tree of G and compute low[] Vertex u is an AP if 1. u is the root and u has >1 children 2. u is not the root and there exists children v where low[v] >= vis[u]

  18. Finding Bridge Find the DFS tree of G and compute low[] Edge (u, v) is a Bridge if 1. v is u children and low[v] > vis[u]

  19. Bi-connected component A bi-connected component (or 2-connected component) is a maximal bi-connected subgraph A bi-connected subgraph is a graph that has no articulation point

  20. Bi-connected component Each Bi-connected component is connected by bridge Each articulation point belongs to more than one Bi-connected component The Bi-connected components form a Tree

  21. Bi-connected component

  22. Strongly Connected Component In a directed graph G, a Strongly Connected Component is a subgraph that there is a path from each vertex to every other vertex in the same SCC.

  23. Strongly Connected Component

  24. Finding SCC • Compute the DFS forest of the graph G to get the death time of the vertices • Reverse all edges in G to form G’ • Compute a DFS forest of G’, but always choose the vertex with the latest death time when choosing the root for a new tree • The SCCs of G are the DFS trees in the DFS forest of G’

  25. F A D B C G H SCC (Demonstration) 1 2 3 13 10 4 14 6 12 9 8 16 11 5 15 7 - A B - A C D C E F A E B H D A D G F B C C G H

  26. A E B H E D F G F C A D B C G H SCC (Demonstration)

  27. Finding SCC Assume (u, v) belongs to the same SCC WLOG, assume u is visited first. Since the exists a path from u to v, we have death[u] > death[v] When we do DFS on G’, we will call DFS(u) first. Since there exists a path from v to u in G, then there exists path from u to v in G’, hence v and u will be in the same tree.

  28. Iterative Depth Searching (IDS)

  29. Bi – Directional Searching (BDS)

More Related