Search code examples
pythonnetworkx

Understanding syntax `clustering(G[, nodes, weight])`


A lot of functions in NetworkX are mentioned like this in the reference. What does this mean starting the square bracket with a comma. e.g. clustering(G[, nodes, weight]) node_redundancy(G[, nodes]) etc. without any first argument.

Is this python syntax or networkx convention?


Solution

  • clustering(G[, nodes, weight]) simply means that the function clustering() takes one required argument G, and optionally two other arguments - nodes and weight. This is fairly standard notation in documentation, regardless of language.