summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDebargha Ganguly <maildebargha@gmail.com>2021-04-09 22:26:55 +0530
committerGitHub <noreply@github.com>2021-04-09 12:56:55 -0400
commite85ec084b792bca13e6f26034fce120762b18eb1 (patch)
tree862f41184ae4153d716b7c31a97bcce587f4ee4d
parentead0e65bda59862e329f2e6f1da47919c6b07ca9 (diff)
downloadnetworkx-e85ec084b792bca13e6f26034fce120762b18eb1.tar.gz
Updating average_clustering() documentation - Issue #4734 (#4735)
* Updating average_clustering() documentation - Issue #4734 * Fixing documentation to include G * Adding output, and fixing random seed
-rw-r--r--networkx/algorithms/approximation/clustering_coefficient.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/networkx/algorithms/approximation/clustering_coefficient.py b/networkx/algorithms/approximation/clustering_coefficient.py
index 56a8f83b..ec61cb83 100644
--- a/networkx/algorithms/approximation/clustering_coefficient.py
+++ b/networkx/algorithms/approximation/clustering_coefficient.py
@@ -37,6 +37,14 @@ def average_clustering(G, trials=1000, seed=None):
c : float
Approximated average clustering coefficient.
+ Examples
+ --------
+ >>> import networkx as nx
+ >>> from networkx.algorithms import approximation
+ >>> G = nx.erdos_renyi_graph(10, 0.2, seed=10)
+ >>> approximation.average_clustering(G, trials=1000, seed=10)
+ 0.214
+
References
----------
.. [1] Schank, Thomas, and Dorothea Wagner. Approximating clustering