0% found this document useful (0 votes)
11 views1 page

Question Paper

The document outlines a mid-semester examination for an artificial intelligence lab at the Indian Institute of Technology Guwahati. It requires students to write a program in C, Java, or Python to determine the shortest path in a weighted undirected graph representing a road network, without using built-in shortest path algorithms. Submission guidelines and marks distribution are provided, emphasizing the importance of correct algorithm implementation and output formatting.

Uploaded by

reddy.gaurav21b
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)
11 views1 page

Question Paper

The document outlines a mid-semester examination for an artificial intelligence lab at the Indian Institute of Technology Guwahati. It requires students to write a program in C, Java, or Python to determine the shortest path in a weighted undirected graph representing a road network, without using built-in shortest path algorithms. Submission guidelines and marks distribution are provided, emphasizing the importance of correct algorithm implementation and output formatting.

Uploaded by

reddy.gaurav21b
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/ 1

I NDIAN I NSTITUTE OF I NFORMATION format, where u, v, and w indicate the existence of

T ECHNOLOGT G UWAHATI an undirected weighted edge between nodes u and


CS236 - A RTIFICIAL I NTELLIGENCE L AB v with weight w. This example represents the follow-
M ID - SEMESTER E XAMINATION ing graph:
T IME : 2 H OURS , M ARKS : 100

Problem Statement
Write a C, Java, or Python program to determine
the shortest path, in terms of total driving distance,
between two locations in a road network repre-
sented as a weighted undirected graph. The weight
of each edge is at least as large as the Euclidean
distance between the corresponding vertices. The
road network data is provided in a text file named
graph data.txt. Each node in the graph repre-
sents a location with specific coordinates, and each
edge represents a road with a given driving distance.
Your program must read this file and implement a
search algorithm to find the optimal path from a
specified starting location to a target location. You Output
must implement the search algorithm yourself; do Assuming the user wants the path from node 2 to
not use built-in library functions or modules (e.g., node 3 following is the output:
networkx in Python) that directly compute shortest
paths. You cannot use Dijkstra’s algorithm. Enter the start node index (0-4): 2
Enter the goal node index (0-4): 3
Path (from start to goal):
Input
2 -> 4 -> 3
An example of the content of the text file named Total Path Cost: 127.26
graph data.txt is as follows:
5 6 Submission Guidelines
96.695882 30.864883 Submit your source code as route <your roll>.x,
48.188706 27.740254 where x is either c, java, or py, and a file
40.391313 98.568165 output <your roll>.txt containing the output in
5.362280 8.607419 the above format, which shows the optimal path an
19.946435 79.894819 its cost.
0 1 57.799213
1 2 73.386690
1 3 72.435762 Marks Distribution
1 4 66.158788
2 4 42.195245 Marks will be awarded as follows (Total 100): 45
3 4 85.065436 marks for correct search algorithm implementation;
20 marks for proper input file handling and graph
The first and second entries are integers n and e,
representation; 25 marks for accurate shortest path
indicating the number of nodes and the number of
and cost calculation; 5 marks for correct output for-
edges. In this example, n is 5 and e is 6. The next n
matting; and 5 marks for code quality (readability,
lines are in
comments, variable names).
x y

format, where x and y indicate each vertice’s first


and second coordinates. The last e lines are in the
u v w

You might also like