DS12_Ch09d - 6 Applications of Depth-First Search /* a...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
§6 Applications of Depth-First Search /* a generalization of preorder traversal */ void DFS ( Vertex V ) /* this is only a template */ { visited[ V ] = true; /* mark this vertex to avoid cycles */ for ( each W adjacent to V ) if ( !visited[ W ] ) DFS( W ); } /* T = O( |E| + |V| ) as long as adjacency lists are used */ 0 1 2 3 4 5 6 DFS ( 0 ) 1. Undirected Graphs void ListComponents ( Graph G ) { for ( each V in G ) if ( !visited[ V ] ) { DFS( V ); printf(“\n“); } } 7 8 0 1 4 6 5 2 3 7 8 1/6
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
§6 Applications of Depth-First Search 2. Biconnectivity Articulation point Biconnected graph v is an articulation point if G’ = DeleteVertex( G, v ) has at least 2 connected components. G is a biconnected graph if G is connected and has no articulation points. A biconnected component is a maximal biconnected subgraph. 〖 Example 〖 0 1 2 3 4 8 7 5 6 9 Connected graph 0 1 1 2 3 4 3 5 8 7 7 5 6 7 Biconnected components Note: No edges can be shared by two or more biconnected components. Hence E(G) is partitioned by the biconnected components of G.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 7

DS12_Ch09d - 6 Applications of Depth-First Search /* a...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online