CS 3343/3341
 Analysis of Algorithms 
  Recitation 11   
   Hints  


Typographical Errors in Problem 1 ( Rec 11, in-class). (These errors have been corrected.)


Chasing down the Adjacency List. Problems 1a, 1b, and 1d each require code that will chase down the adjacency list for a given vertex, doing something with each item (= edge) on the list. Most of you have probably successfully done this already, but if you are still having trouble, here is code to do it:
In Java LanguageIn C Language
Edge e = graph[i].firstEdge;
while (e != null) {
   // do something with edge e
   //   ...
   // move to next edge (if present)
   e = e.nextEdge;
}
struct edge* e = graph[i] -> firstedge;
while (e != NULL) {
   // do something with edge e
   //   ...
   // move to next edge (if present)
   e = e -> nextedge;
}


Input file for the "48 Capitals" example, used in Problem 1.


"edgeLength" functon: This returns a value different from -1 only if the adjacency list for vertex (node) v1 has v2 as one of the entries.


Input file small.txt used in Problem 1. This is the file for the Java version. If you use my C code, then you need a file with the first line deleted and with the line #define GRAPHSIZE 11 in the C code.


Problem 2 of Recitation 1:


Revision date: 2012-11-09. (Please use ISO 8601, the International Standard Date and Time Notation.)