COMP931 3 2017 s 2 Project 2
Single source shortest path
Given a graph and a node s , find the shortest distances together with the paths from s to all nodes.. For example,,
the shortest distance from
s to 3 is
9 with path s
>22
>11
>33..
Input files :
In the input file,, each line is in format of::
EdgeId FromNodeId ToNodeId Distance .
In the above example,, the input contains::
0 0 1 10.0
1 0 2 5.0
2 1 2 2.0
3 1 3 1.0
4 2 1 3.0
5 2 3 9.0
6 2 4 2.0
7 3 4 4.0
8 4 0 7.0
9 4 3 6.0
Th is sample file tiny graph .ttxt can be downloaded at::
https::////wwebcms3..ccse..uunsw..eedu..aau//CCOMP9313//117s2//rresources//112283
O utput::
Set the number of reducers to 1.. The single output file contains distances of the given node to all nodes.. Each line is in format of TargetNodeID t Distance t Path . The distances are of double precision , and each path is a sequence of nodes on the shortest path . Remove the nodes that are not reachable to the query node,, and s ort the output by TargetNodeID according to its numeric value.. Given the example graph,, the output file is like::
0 t 0.0 t
0
1 t 8.0 t
0
>22
>11
2 t 5.0 t
0
>22
3 t 9.0 t
0
>22
>11
>33
4 t 7.0 t
0
>22
>44
Code format :
Name your java file as SingleSourceSP .jjava , and put it in the package comp9313..aass 2 . Your program should take three parameters:: the input folder containing the graph file , the output folder stor ing the final result file , and the query source node ID .
Hints::
1.. One difficulty of this problem is how to do the iterative MapReduce jobs.. You can download the code template at::
https::////wwebcms3..ccse..uunsw..eedu..aau//CCOMP9313//117s2//rresources//112284
, which may help you solve this problem..
2.. Another difficulty is how to check the termination criterion,, and you are requ ired to utilize the counter to do this job..
3.. After the iterations are finished (ii..ee..,, all shortest distances are found)),, the output format is not as required.. Thus,, you need to use another round map//rreduce to convert the output to the desired format.. Pleas e use the output folder given in the parameter to store the final result..
Documentation and c ode r eadability
Your source code will be inspected and marked based on readability and ease of understanding.. The documentation ( comments of the codes)) in your source code is also important.. Below is an indicative marking scheme::
Result correctness:: 80%%
Code structure,, R eadability,, and Documentation:: 20%%
S ubmission::
Deadline:: Sunday 1 7 th Sep 09::559::559 PM
Log in any CSE server (ww illiams or wagner)),, and u se the give command below to submit your solutions :
$ give cs9313 assignment 2 Single Source SP..jjava
O r you can submit through::
https::////ccgi..ccse..uunsw..eedu..aau//~~ggive//SStudent//ggive..pphp
If you submit your assignment more than once,, the last submission will replace the previous one.. To prove successful submission,, please take a screenshot as assignment submission instructions show and keep it by yourself..
Late submission penalty
10%% reduction of your marks for the 1st day,, 30%% reduction//dday for the following days .
Plagiarism :
The work you submit must be your own work.. Submission of work partially or completely derived from any other person or jointly written with any other person is not permitted.. The penalties for such an offence may include negative marks,, automatic failure of the course and possibly other academic discipline.. Assignment submissions will be examined manually.. Relevant scholarship authorities will be informed if studen ts holding scholarships are involved in an incident of plagiarism or other misconduct.. Do not provide or show your assignment work to any other person apart from the teaching staff of this subject.. If you knowingly provide or show your assignment work to another person for any reason,, and work derived from it is submitted you may be penalized,, even if the work was submitted without your knowledge or consent..
Reviews
There are no reviews yet.