Add diam function.

Added diam(G) to calculate the diameter of a graph, updated
documentation, and a bug fix.