Skip to content

VlADOOSit/UCODE-Pathfinder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UCODE-Pathfinder

The program finds all the shortest paths between all islands.

Examples

>cat -e example1$
Greenland-Bananal,8$
Fraser-Greenland,10$
Bananal-Fraser,3$
Java-Fraser,5$
>./pathfinder example1 |cat -e
========================================$
Path: Greenland -> Bananal$
Route: Greenland -> Bananal$
Distance: 8$
========================================$
========================================$
Path: Greenland -> Fraser$
Route: Greenland -> Fraser$
Distance: 10$
========================================$
========================================$
Path: Greenland -> Java$
Route: Greenland -> Fraser -> Java$
Distance: 10 + 5 = 15$
========================================$
========================================$
Path: Bananal -> Fraser$
Route: Bananal -> Fraser$
Distance: 3$
========================================$
========================================$
Path: Bananal -> Java$
Route: Bananal -> Fraser -> Java$
Distance: 3 + 5 = 8$
========================================$
========================================$
Path: Fraser -> Java$
Route: Fraser -> Java$Distance: 5
$========================================$
>cat -e example2$
A-B,11$
A-C,10$
B-D,5$
C-D,6$
C-E,15$
D-E,4$
>./pathfinder example2 |cat -e
========================================$
Path: A -> B$
Route: A -> B$
Distance: 11$
========================================$
========================================$
Path: A -> C$
Route: A -> C$
Distance: 10$
========================================$
========================================$
Path: A -> D$
Route: A -> B -> D$
Distance: 11 + 5 = 16$
========================================$
========================================$
Path: A -> D$
Route: A -> C -> D$
Distance: 10 + 6 = 16$
========================================$
========================================$
Path: A -> E$
Route: A -> B -> D -> E$
Distance: 11 + 5 + 4 = 20$
========================================$
========================================$
Path: A -> E$
Route: A -> C -> D -> E$
Distance: 10 + 6 + 4 = 20$
========================================$
========================================$
Path: B -> C$
Route: B -> D -> C$
Distance: 5 + 6 = 11$
========================================$
========================================$
Path: B -> D$
Route: B -> D$
Distance: 5$
========================================$
========================================$
Path: B -> E$
Route: B -> D -> E$
Distance: 5 + 4 = 9$
========================================$
========================================$
Path: C -> D$
Route: C -> D$
Distance: 6$
========================================$
========================================$
Path: C -> E$
Route: C -> D -> E$
Distance: 6 + 4 = 10$
========================================$
========================================$
Path: D -> E$
Route: D -> E$
Distance: 4$
========================================$