Skip to content

doc: improve docstring for hypercube_graph. - #8012

Merged
dschult merged 14 commits into
networkx:mainfrom
ishrathtahaseen-9:fix-hypercube-docstring
Jul 9, 2025
Merged

dschult merged 14 commits into
networkx:mainfrom
ishrathtahaseen-9:fix-hypercube-docstring

Conversation

@ishrathtahaseen-9

@ishrathtahaseen-9 ishrathtahaseen-9 commented Apr 30, 2025 •

Copy link
Copy Markdown
Contributor

Closes #7942

improving docstring for hypercube graph

@ishrathtahaseen-9

Copy link
Copy Markdown
Contributor Author

Help Needed: Test Failures in hypercube_graph

Hi everyone,

I’ve encountered a couple of issues with the tests in my PR, specifically in the doctest for the networkx.generators.lattice.hypercube_graph function. The test is failing with the following error message: test/default. i would appreciate if anyone ackonwledge me about this

@LorentzFactor

Copy link
Copy Markdown
Contributor

I’ve encountered a couple of issues with the tests in my PR, specifically in the doctest for the networkx.generators.lattice.hypercube_graph function. The test is failing with the following error message: test/default. i would appreciate if anyone ackonwledge me about this

Try running the commands from the example in your local python interpreter. Ensure that, when run in order, each command executes successfully, and that their output exactly matches what is given in the example.

@ishrathtahaseen-9

Copy link
Copy Markdown
Contributor Author

I’ve encountered a couple of issues with the tests in my PR, specifically in the doctest for the networkx.generators.lattice.hypercube_graph function. The test is failing with the following error message: test/default. i would appreciate if anyone ackonwledge me about this

Try running the commands from the example in your local python interpreter. Ensure that, when run in order, each command executes successfully, and that their output exactly matches what is given in the example.

hii,
i have cleared the errors in the examples but im getting the errors of default/task what should i do with that

@MridulS MridulS left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!

Please do go through the networkx tutorial and the contributing guide to get a better overview of networkx development :)

Comment thread networkx/generators/lattice.py Resolved
Comment thread networkx/generators/lattice.py Resolved
Comment thread networkx/generators/lattice.py Resolved
Comment thread networkx/generators/lattice.py Resolved
@ishrathtahaseen-9

Copy link
Copy Markdown
Contributor Author

Hi @MridulS ,
I've completed the required changes and all tests are passing locally but, the "label/reviewer label" check is showing an error on the pull request.
could you please help by assigning a label/reviewer so the check passes. i'm open for any suggestions.
Thank you!

Comment thread networkx/generators/lattice.py Resolved
Comment thread networkx/generators/lattice.py Resolved
Comment thread networkx/generators/lattice.py Resolved
Comment thread networkx/generators/lattice.py Resolved
@rossbar

rossbar commented May 1, 2025

Copy link
Copy Markdown
Contributor

@ishrathtahaseen-9 just a heads up - there was already a PR open for this. Generally it's good to double-check that there aren't already existing PRs for issues. No worries in this case, as the other one had gone stale, so let's focus on getting this in!

@ishrathtahaseen-9

Copy link
Copy Markdown
Contributor Author

@ishrathtahaseen-9 just a heads up - there was already a PR open for this. Generally it's good to double-check that there aren't already existing PRs for issues. No worries in this case, as the other one had gone stale, so let's focus on getting this in!

Thank you! for letting me know, i'll make sure to check for existing PRs next time.Looking forward to getting this one merged!

@ishrathtahaseen-9
ishrathtahaseen-9 force-pushed the fix-hypercube-docstring branch from 5052c61 to c9b9577 Compare May 2, 2025 07:24

@amcandio amcandio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The types of graphs seem like a good use case for dynamic graphs, where we don't store the nodes and edge on memory but we generate them on-demand based on their predefined relationships.

@ishrathtahaseen-9

Copy link
Copy Markdown
Contributor Author

LGTM. The types of graphs seem like a good use case for dynamic graphs, where we don't store the nodes and edge on memory but we generate them on-demand based on their predefined relationships.

"Thanks for the feedback and the suggestion! I agree that dynamic graphs could be a great way to optimize memory usage, especially for large or complex graphs. I’ll definitely keep this in mind for future enhancements. Appreciate your input!"

@LorentzFactor LorentzFactor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we consistently italicize n-?

Comment thread networkx/generators/lattice.py Resolved
@rossbar

rossbar commented May 2, 2025

Copy link
Copy Markdown
Contributor

It looks like @MridulS 's suggestions have been overridden by a force-push. @ishrathtahaseen-9 please make sure you pull before pushing again so we don't lose the contributions from reviewers!

Comment thread networkx/generators/lattice.py Resolved
Comment thread networkx/generators/lattice.py Resolved
@ishrathtahaseen-9

Copy link
Copy Markdown
Contributor Author

It looks like @MridulS 's suggestions have been overridden by a force-push. @ishrathtahaseen-9 please make sure you pull before pushing again so we don't lose the contributions from reviewers!

Thank you for pointing that out! I apologize for the force-push- i'll make sure the latest changes before pushing next time to avoid overwriting any suggestions. Please let me know if there is any way i can undo it or recover the suggestions. Appreciate the feedback!

@ishrathtahaseen-9

Copy link
Copy Markdown
Contributor Author

Should we consistently italicize n-?
Thanks for pointing that out! I agree that consistency is important. The n-dimensional hypercube is commonly represented with an italicized "n" in mathematical and scientific contexts, so I chose to keep it italicized throughout the docstring.

rossbar and others added 2 commits July 9, 2025 03:01
@rossbar
rossbar force-pushed the fix-hypercube-docstring branch from 374cf3c to 3483d3f Compare July 9, 2025 10:19

@rossbar rossbar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In an attempt to get this unstuck, I went ahead and re-applied some of the comments and made a few opinionated changes of my own (e.g. switching the example from edges -> neighbors).

My preference would be to get this in then continue iterating in follow-up PRs just to get it off the docket. Thanks @ishrathtahaseen-9 !

Co-authored-by: Mridul Seth <[email protected]>
@rossbar
rossbar force-pushed the fix-hypercube-docstring branch from 3483d3f to bfa04bc Compare July 9, 2025 10:23
Comment thread networkx/generators/lattice.py Resolved

@dschult dschult left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ishrathtahaseen-9 !!

@dschult
dschult merged commit aeb4498 into networkx:main Jul 9, 2025
amcandio pushed a commit to amcandio/networkx that referenced this pull request Jul 20, 2025
* doc: improve docstring for hypercube_graph

* doc:finalize docstring for hypercube_graph

* style:reformatted code with black

* correcting the example in hypercube docstring

* reformatting using black

* improve docstring for hypercube_graph

* further imrove docstring for hypercube_graph

* fix docstring formatting for hypercube_graph

* improving docstring for hypercube_graph function

* fix formatting and improve docstring for hypercube_graph

* Update networkx/generators/lattice.py

Co-authored-by: Colman Bouton <[email protected]>

* Update networkx/generators/lattice.py

Co-authored-by: Colman Bouton <[email protected]>

* Touchups

Co-authored-by: Mridul Seth <[email protected]>

* First line of docstring grammar and whitespace

---------

Co-authored-by: Ross Barnowski <[email protected]>
Co-authored-by: Colman Bouton <[email protected]>
Co-authored-by: Mridul Seth <[email protected]>
Co-authored-by: Dan Schult <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

networkx.hypercube_graph documented as having nodes indexed by integers, actually uses n-tuples

6 participants