Google Answers Logo
View Question
 
Q: Write a program for forward search algorithm(DIJKASTRA ALGORITHM) ( No Answer,   0 Comments )
Question  
Subject: Write a program for forward search algorithm(DIJKASTRA ALGORITHM)
Category: Computers > Programming
Asked by: navneet-ga
List Price: $7.00
Posted: 07 Nov 2002 22:57 PST
Expires: 08 Nov 2002 08:59 PST
Question ID: 102503
Forward Search Algorithm (Dijkastra's Algorithm)
Use c++ to compile the program
Writing the program in c is fine.


Write a program to implement a Forward Search Algorithm to obtain the
minimum cost path in a computer network.Let n(n<30)be the number of
interconnected computers.Read the input from a file which should have
(n*n) connection and distance/cost matrices.Use fig1.in to verify your
code and generate a minimum cost routing from any city/node to any
other city/node.

Programing description:
you dont have any user interface screen but you have to implement the
following tasks:
1)Display one to all paths.    //with  minimum cost only with link
weight.
2)Display one to one path.   //with minimum cost with node and link
weight.

How to test the program.
You run the program with 3 files.
one is the graph file(file1),the other is the node file(file2) and the
third is the order file(file3).

Format)your_compiled_program file1 file2 file3
example)a.out fig1.in node.in data.in

The program will read a file from fig1.in,node.in files and test it
with the orders in data.in file.

Content of data.in file(only example: the city names may be changed
but the order should be the same)

New_York	//source	node for one to all path with link cost only
New_York	//source	node for one to one path with minimum cost(link and
node)
Zanzibar	//destination	node for one to one path with minimum cost(link
and node)

Your program will read contents of data.in file and will generate the
following:
One to all path from New_york , (first line).
One to one path from New_york to Rio with minimum cost(second and
third lines)

Output format for one to all paths.
Source	path	destination	cost	no:of intermediate cities
New york	London	         1	       0
Newyork	London	Paris	         3	       1
New york
· * * * * *  
· * * * * *
New york

Output fromat for one to one path(when node cost is zero).
Shortest path between source (New york) and destination(Sydney):
	New york-Rio-Zanzibar-Calcutta-Sydney
Total cost for (New york,Sydney) path: 6 units
The number of intermediate cities: 3 cities



Fig1.in:-1 implies nodes I and j are not connected directly

From\t0   ny  lo  ge  to  pa  ro  ho  ri  za  ca  sy

New york  0   1   -1  -1  -1  -1  -1   2  -1  -1  -1
London	  1   0    3  -1   2  -1  -1  -1  -1  -1  -1
Geneva	 -1   3    0   3   1   1  -1  -1  -1  -1  -1
Tokyo	 -1  -1	   3   0  -1   3   1  -1  -1  -1  -1
Paris    -1   2    1  -1   0   1  -1   3  -1  -1  -1
Rome	 -1  -1	   1   3   1   0  -1  -1   1   3  -1
Hong kong-1  -1	  -1   1  -1  -1   0  -1  -1   3   2
Rio	  2  -1	  -1  -1   3  -1  -1   0   2  -1  -1
Zanzibar -1  -1	  -1  -1  -1   1  -1   2   0   1  -1
Delhi	 -1  -1	  -1  -1  -1   3   3  -1   1   0   1
Sydney	 -1  -1	  -1  -1  -1  -1  -1  -1  -1   1   0




Contents of the node.in file
New York 0.5
London 0.7
Geneva 0.4
Tokyo 0.5
Paris 0.1
Rome 2
Hong Kong 3
Rio 0.2
Zanzibar 0.6
Delhi 0.5
Sydney 0.7


//Example//
The cost from New York to London is 0.5+1+0.7=2.2//
Answer  
There is no answer at this time.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy