CS 558 - Computer Networks
Homework 4

Due: See class webpage.

1. Dijkstra's Algorithm

Write a C++ or Java program that reads in a network topology stored in an input file and prints the routing table for every node. The network topology file has the following form:
   NumberOfNodes

   ..  ..  ..  ..  (distances between nodes)
   ..  ..  ..  ..
   etc
The distance entries are integers and a positive entry denotes a link cost. The distance entry 0 denotes that there is no link between the nodes.

For example, the following network topology:

is denoted by the following input file:

   5
   0   0   5   0   0
   0   0   3   9   0
   5   7   0   5   8
   0   3   9   0   7
   0   0   5   7   0
The output of the routing tables must be of the form:
  Node 1:

    Destination | Next Node
   -------------+------------
        1       |    ... <- this "to yourself" entry is "don't care"
        2       |    ...
        3       |    ...
       ....

  Node 2:

    Destination | Next Node
   -------------+------------
        1       |    ...
        2       |    ... <- this "to yourself" entry is "don't care"
        3       |    ...
       ....

  and so on.
For the "don't care", entry, print a "*" as "Next Node".

The executable must be named main.

(I want this rigid format to simplify grading !)

2. Turn in

You must turn in the following items, and make sure you turn in the Makefile as item hw4.