Thursday, April 8, 2010

Adjacency Matrix

Last lab was a little tough but with some pointers from the professor I finished it. I had to write a new member function "degree" for the Wtgraph C++ class given. The "degree" function should determine and output how many even degree vertices there are and how many odd degree vertices, and then calculate the weight of them all. The trouble I was having was that instead of my for loop adding up each row and doing the odd/even check it did the check for each vertex. All I had to do though was move the check outside of the for loop for "j" and add a row/column counter. Doh!