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/ 1
UCS 1312 Data Structures Lab
A9: Learning to implement and traverse graphs and their applications
--Dr. R. Kanchana
Best Practices to be adapted
Modular design and coding using versions Simple and Understandable UI design Test case design – minimal and adequate test cases Guiding error messages in case of invalid inputs ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Write algorithms for applications and trace them with an example. Inspect the steps using the diagrammatic representation of the tree. (CO2, K3) 1. Create a graph as an adjacency matrix and traverse it using DFS (recursive) and BFS (iterative). 2. Test bfs() for a disconnected graph 3. You are given a set of persons P and their friendship relation R. That is, (a, b) ∈ R iff a is a friend of b. You must find a way to introduce person x to person y through a chain of friends. Model this problem with a graph and solve the problem. 4. You are given a set of cities and aircrafts routes. Model the routes using a graph. Given two cities, find whether there exists a direct flight between two cities; if not use a search algorithm and show the hops and connecting flights. (OPTIONAL) From City To City Flight Chennai Delhi 1 Chennai Bangalore 2 Chennai Hyderabad 3 Hyderabad Vizag 4 Hyderabad Chennai 5 Madurai Delhi 6 Chennai Trichy 7 Trichy Chennai 8 Vizag Delhi 9 Bangalore Trichy 10 Delhi Bangalore 11
Eg. I/P: Hyderabad to Delhi
O/P: No direct flight No Connecting flights too I/P: Chennai to Delhi O/P: Direct flight available - Flight number 1 I/P: Trichy to Delhi O/P: No direct Flight Connecting flights Trichy – Chennai – Delhi Flight number 8 – 1 Trichy – Chennai – Hyderabad – Vizag – Delhi Flight 8 – 3- 4 - 9