0% found this document useful (0 votes)
11 views5 pages

Dsa - QB - Unit Iv

QUESTION BANK UNIT 4

Uploaded by

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

Dsa - QB - Unit Iv

QUESTION BANK UNIT 4

Uploaded by

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

Unit 4

NON LINEAR DATA STRUCTURES – GRAPHS

Course objective: To apply Graph data structure


Course Outcome: Apply the different non-linear data structures to problem solutions.
Bloom’s Taxonomy Level: K1, K2, K3, K4
PART A
Q.N Question BTL

1. What is a graph? K1
A Graph is a non-linear data structure consisting of nodes and edges. The nodes are
sometimes also referred to as vertices and the edges are lines or arcs that connect any
two nodes in the graph.

2. List the types of graph. K1


Types:
Directed graph
Undirected graph
Complete graph
Cyclic graph
Acyclic graph

3. Consider the graph given below. Create the adjacency matrix of it K6

4. Find out the in-degree and out-degree of each node in the given graph K1

Vertex Indegree Outdegree


A 1 2
B 1 2
C 1 1
D 3 3
E 2 0

5. Create a complete undirected graph having five nodes K6


A complete graph has an edge between every pair of vertices. For a given number of
vertices, there's a unique complete graph, which is often written as Kn, where n is the
number of vertices.

6. Given the following adjacency matrix, draw the weighted graph. K3

7. Give the purpose of Dijikstra’s algorithm K2


Dijkstra's algorithm is called the single-source shortest path. It is also known as the
single source shortest path problem. It computes length of the shortest path from the
source to each of the remaining vertices in the graph

8. Define cyclic and acyclic graph K1

A cyclic graph is a directed graph which contains a cycle ( a path from at least one
node back to itself).
An acyclic graph is a directed graph which contains absolutely no cycle, that is no
node can be traversed back to itself.

9. Classify strongly connected and weakly connected graph K4

strongly connected graph weakly connected graph

A directed graph is strongly connected A directed graph is weakly connected


if there is a path between all pairs of If there ia a path from every two
vertices.( there is a path from A to B vertices of the graph when the
and B to A whenever A and B are direction of edges are disregarded
vertices in the graph)

10. Define the length of the graph. K1


length of the graph is defined as the Number of edges in the longest path from the root
node to the leaf node

11. Define minimum spanning tree. K1


A spanning tree is a subset of Graph G, which has all the vertices covered with
minimum possible number of edges. Hence, a spanning tree does not have cycles
In a weighted graph, a minimum spanning tree is a spanning tree that has minimum
weight than all other spanning trees of the same graph.

12. State the principle of Topological sorting. K1


A topological sort is a linear ordering of vertices in a directed acyclic graph such that if
there is a path from vi to vj then vj appears after vi in the linear ordering.

13. Explain procedure for Depth first search algorithm. K2


Depth first search works by selecting one vertex V of G as a start vertex; V is marked
veisited . Then each unvisited vertex adjacent to V is searched in turn using depth first
search recursively. This process continues until no unvisited vertices are encountered.

14. What are the two ways of representing a graph. K1


1. Adjacency matrix
2. Adjacency list

15. Define indegree and outdegree of a graph. K1


 The indegree of a vertex V , is the number of edges entering in to the vertex V
 The outdegree of the vertex v, is the number of edges exiting from the vertex V.

16. List out the applications of Graph. K1


 To define the flow of computation.
 To represent networks of communication.
 To represent data organization.
 Widely using in Google maps, Facebook, WWW

17. Define Prim’s algorithm. K1

Prim's Algorithm is a greedy algorithm that is used to find the minimum spanning tree
from a graph. Prim's algorithm finds the subset of edges that includes every vertex of
the graph such that the sum of the weights of the edges can be minimized.

18. Mention the procedure to find minimum spanning tree using Kruskal’s K1
Algorithm.
o First, sort all the edges from low weight to high.
o Now, take the edge with the lowest weight and add it to the spanning tree. If the
edge to be added creates a cycle, then reject the edge.
o Continue to add the edges until we reach all vertices, and a minimum spanning
tree is created.

19. Differentiate BFS and DFS. K4

S. Parameters Breadth First Search Depth First Search


No.

1. Data Structure uses Queue data structure for uses Stack data
finding the shortest path. structure.

2. Definition walk through all nodes on the same traverse begins at


level before moving on to the next the root node and
level. proceeds through
the nodes as far as
possible until we
reach the node with
no unvisited nearby
nodes.

3. Technique used to find a single source shortest In DFS, we might


path in an unweighted graph because, traverse through
in BFS, we reach a vertex with a more edges to reach
minimum number of edges from a a destination vertex
source vertex. from a source.

4. Approach First In First Out. Last In First Out.

20. Explain procedure for Breadth first search algorithm. K1

Step 1: Take an Empty Queue.

Step 2: Select a starting node (visiting a node) and insert it into the Queue.

Step 3: Provided that the Queue is not empty, extract the node from the Queue and
insert its child nodes (exploring a node) into the Queue.

Step 4: Print the extracted node.


PART B
Q:n Question BTL
o
1 Describe in detail about the following representations of a graph. R
i. Adjacency Matrix (7)
ii. Adjacency list (6)
2 State and apply topological sorting for the given graph (16)

3 Differentiate depth-first search and breadth-first search traversal of a graph with


suitable examples. (16)
4 Develop an algorithm to compute the shortest path using Dijkstra’s algorithm. Find
single source shortest path for the given graph (16)

5 Show how Prims algorithm and Kruskals algorithm are used to find the minimum
spanning tree for the given graph. (16)

6 Apply appropriate algorithm to find the shortest path from ‘A’ to every other node of
A.For the given graph (16)

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