This preview shows page 1. Sign up to view the full content.
Unformatted text preview: 234 Lecture 20 Page 2 Example:
The following code takes a graph and checks if there is a path between every pair of vertices. If so, then the graph is connected and the code does nothing to . If is disconnected, edges are added to make the graph connected. ADT Graph Implementation
Example: Edge List
, , ,…, where each edge is , , where and are endpoints of the edge. From ∗ , we have:
1,2 , 1,5 , 2,3 , 2,5 , 3,4 , 4,5 , 4,6
We can add edge weights to the tuples. For example, edge 1,2 has weight 6, so its tuple is 1,2,6 . Our n...
View Full Document
This note was uploaded on 02/04/2014 for the course CS 234 taught by Professor Baranoski during the Spring '09 term at Waterloo.
- Spring '09