Exercise 4: Checking Neighbours (i)
Assuming an array-of-edges representation ...
Write a function to check whether two vertices are directly connected by an edge
Use the function interface:
int connected(Graph g, Vertex x, Vertex y) { ... }
|
Assume that
- we use canonical edge representation (v < w)
- we maintain the array of edges in sorted order
Don't assume that x < y .
|