Nasrin Hakim Mithila
Dept. of Computer Science and Engineering(CSE)
Faculty of Science & Information Technology (FSIT)
Daffodil International University
Our Group Name: Silent Hunter
1. Syed Ahmed Zaki (ID:131-15-2169)
2. Md. Sazzad Hossain (ID:131-15-2368)
Project No. 1 in the project list
There are n SMTP servers connected by network cables. Each
of the m cables connects two computers and has a certain
latency measured in milliseconds required to send an email
message. What is the shortest time required to send a
message from server S to server T along a sequence of
cables? Assume that there is no delay incurred at any of the
The first line of input gives the number of cases, N. N test
cases follow. Each one starts with a line containing n
(2<=n<20000), m (0<=m<50000), S (0<=S<n) and T
(0<=T<n). S!=T. The next m lines will each contain 3
integers: 2 different servers (in the range [0, n-1]) that are
connected by a bidirectional cable and the latency, w, along
this cable (0<=w<=10000).
For each test case, output the line "Case #x:" followed
by the number of milliseconds required to send a
message from S to T. Print "unreachable" if there is no
route from S to T.
N // N = Test Case Number
n m S T
int int w
//n =SMTP servers on the network (2<=n<20000), m=cables connects two
computers(0<=m<50000), S=Source server (0<=S<n) , T=Target Server
(0<=T<n) (where S!=T)
//int=integer value, int=integer value, w=latency/weight of the
Case #2: 0 1
Case # 3: unreachable
As from the input description we have found that we
have to iterate through all vertex but in minimum
shortest path from one source.So that We have used
Dijkstra algorithm here.As Dijkstra algorithm is single
source shortest path algorithm.
We have a plan to make it more frequently and user
And will make available this code for open source
We have to use here delimiter “+” in Java’s built in
input/output system in BufferedReader
throwsException() function to avoid unexpected
integer or string error.
We will fix this bug in future version .
Implementing and focusing on the code was our main
objective and we tried our best.
Thank you Mam for staying with us.
Thank you all.