http://www.oocities.org/SiliconValley/Peaks/8778/TAU_advprog.html

Advanced Programming Course - Exercise 6


To write a program that will traverse an undirected graph starting from some node and print the nodes' labels in order of the traversing. Take the following graph as a test case:
Nodes' labels:

  1. Tel-Aviv
  2. Jerusalem
  3. Haifa
  4. Petakh-Tikva
  5. Beer-Sheva
  6. Ashdod
  7. Netania
  8. Herzelia
  9. Raanana
  10. Hadera
Adjacency matrix:

  | 1 2 3 4 5 6 7 8 9 10
------------------------
 1| 0 1 0 1 1 1 0 1 0 0
 2| 1 0 0 1 0 0 0 0 0 0
 3| 0 0 0 0 0 0 0 0 0 1
 4| 1 1 0 0 0 0 0 0 1 0
 5| 1 0 0 0 0 1 0 0 0 0
 6| 1 0 0 0 1 0 0 0 0 0
 7| 0 0 0 0 0 0 0 1 0 1
 8| 1 0 0 0 0 0 1 0 1 0
 9| 0 0 0 1 0 0 0 1 0 1
10| 0 0 1 0 0 0 1 0 1 0
Please test your program for start points 1, 3, 9.