Repository navigation
maint: use nx.circulant_graph to generate Harary graphs - #8189
Conversation
Co-authored-by: Ross Barnowski <[email protected]>
| @nx._dispatchable(graphs=None, returns_graph=True) | ||
| def hnm_harary_graph(n, m, create_using=None): | ||
| """Returns the Harary graph with given numbers of nodes and edges. | ||
| r"""Return the Harary graph with given numbers of nodes and edges. |
There was a problem hiding this comment.
Can you remind me why we need to change this doc_string to raw (with the r in front)?
Is it because we are using latex?
Also, why are we changing Returns to Return? I thought we were moving toward using the gammar Returns on all the doc_strings. Seems like we switch back and forth over the years. Wish we just didn't bother. :)
There was a problem hiding this comment.
Yes, the raw docstring makes the LaTeX backslash commands render nicely–it's either that or having to escape the backslashes, which makes the docstring harder to read.
The change from Returns to Return is simply to comply with PEP 257, more specifically this bullet:
The docstring is a phrase ending in a period. It prescribes the function or method’s effect as a command (“Do this”, “Return that”), not as a description; e.g. don’t write “Returns the pathname …”.
PEP 257 is the convention linked to in the numpydoc style guide, which we follow (as do NumPy, SciPy, and the scikits). I'm happy to back out the change if you feel strongly, though. :)
This PR does a few related things:
nx.circulant_graph.nx.circulant_graphin the Harary graph generators + batch edge additions where possible.