Clustering coefficient of a graph in Java