Week 4: Lab Document, 9/20

Let G be a graph with vertex set V and edge set E. For any vertex v in G, the clustering coefficient of v, denoted C(v), is the ratio of the number of edges between pairs of neighbors of v to the total number of pairs of neighbors of v. For example, say vertex v has 10 neighbors. Then v has (10 choose 2) = 45 pairs of neighbors and suppose that of these pairs of neighbors 15 pairs are connected by edges. Then the clustering coefficient of v is 1/3. If a vertex has one or no neighbors, let us define its clustering coefficient to be 1. The clustering coefficient of G, denoted C(G), is the average of the clustering coefficients of all the vertices in G. The value of C(v), for any v, is between 0 and 1 and therefore the value of C(G) is also between 0 and 1.

Problem:

1. Add the following two methods to the myGraph class to respectively compute the clustering coefficient of a given vertex and the clustering coefficient of the graph.
```	public double clusteringCoefficient(String v)
public double clusteringCoefficient()
```