0% found this document useful (0 votes)
26 views4 pages

Tutorial Week-10 Set-2 Solution

The document provides a tutorial on discrete algorithms and data structures. It contains 3 questions and their solutions related to topological sorting, finding connected components using DFS, and finding articulation points using Tarjan's algorithm.

Uploaded by

devc96048
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views4 pages

Tutorial Week-10 Set-2 Solution

The document provides a tutorial on discrete algorithms and data structures. It contains 3 questions and their solutions related to topological sorting, finding connected components using DFS, and finding articulation points using Tarjan's algorithm.

Uploaded by

devc96048
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

School of Computer Science Engineering and Technology

Course-B.Tech Type- Core


Course Code- CSET206 Course Name- DAA (Tutorial-10)

Year- 2024 Semester- EVEN


Date- 20/03/2024 Batch- 2022-2026

CO-Mapping
CO1 CO2 CO3
Q1 √
Q2 √
Q3 √

Objectives
1. Students will be able to learn how to find the topological sorting of a
graph.
2. Students will be able to learn how to apply DFS to get the number of
connected components in a graph.
3. Students will be able to learn how to apply DFS to find the articulation
points in a graph (Tarjan’s Algorithm).

Q1. Consider the following directed graph


School of Computer Science Engineering and Technology

Find the topological sorting of the given graph.


Solution:
Steps to Find Topological Sorting
1. Apply DFS to get the finishing time for all the vertices.
2. List the vertices in decreasing order of their finishing time.

One of the topological sortings of the above graph is as follows:


A, C, D, B, E, H, F, G.

Q2. Consider the following graph


School of Computer Science Engineering and Technology

Find the number of connected components using DFS.


Solution:
The algorithm to compute the number of connected components is as
follows:

Apply the above Algorithm to the given graph


Total number of connected components = 3 [{v1, v2, v3, v4, v5, v6}, {v7,
v8, v9}, {v10, v11, v12}]

Q3. Find the articulation points in the given graph using Tarjan’s Algorithm

Solution:
Steps of Tarjan’s Algorithm to find articulation points:
[Step 1.] Find the depth-first spanning tree T for G
[Step 2.] Add back edges in T
School of Computer Science Engineering and Technology

[Step 3.] Determine DNF(i) and L(i)


✓ DNF(i): the visiting sequence of vertices i by depth-first search
✓ L(i): the least DFN reachable from i through a path consisting of
zero or more tree edges followed by zero or one back edge

[Step 4.] Vertex i is an articulation point of G if and only if either:


✓ i is the root of T and has at least two children
✓ i is not the root and has a child j for which L(j)>=DFN(i)

Articulation points: A, H, G, J

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy