networkx/networkx — pull request #862 by FedericoV (2013-04-02 13:02:18+00:00)
Title: Small world

I've added code, docstring and tests for a few functions.

- A linear algebra based implementation of the clustering coefficient, which also works for directed and weighted graphs. Based on:
http://web1.sssup.it/pubblicazioni/ugov_files/303163_PRE_2007.pdf. Tests also present for the weighted and unweighted undirected case.

- A bootstrapping based implementation of the small world coefficient, using either clustering coefficient or transitivity. Based on:
http://www.plosone.org/article/info:doi/10.1371/journal.pone.0002051

- A average_shortest_path_length_weakly_connected function, calculating the average distance for weakly connected graphs, which correctly normalizes the average distance by the total number of actual paths present in the graph. This is separate from average_shortest_path_length to preserve backward compatibility. Tests also present.