Skip to content

Conversation

@alifa98
Copy link
Contributor

@alifa98 alifa98 commented Dec 7, 2021

Hi all,

I have added the "corona product" of two graphs in the product algorithms.
I also had written a blog post here about this product months ago.

Thank you

@dschult dschult added this to the networkx-2.7 milestone Dec 9, 2021
@dschult
Copy link
Member

dschult commented Dec 9, 2021

Thank you for this PR. The Corona product is a helpful feature to add. And this implementation looks good to me.

Can you add corona_product to the list of functions to link to in the documentation? doc/reference/algorithms/operators.rst That will link this doc_string to the reference section of the docs.

Are there performance issues we should think about? I think CPU usage is not an issue. What about memory? If you have a really big H (or G) will there be a bottleneck in new_edges getting huge? If so, you could loop over list(GH) and add the nodes/edges to GH as you go. Anything else like that?

Thanks!

@rossbar rossbar modified the milestones: networkx-2.7, networkx-3.0 Feb 12, 2022
@alifa98
Copy link
Contributor Author

alifa98 commented Feb 15, 2022

Hi,
As you said, I have added corona_product to doc/reference/algorithms/operators.rst.

Your concern about memory usage in large graphs was correct, so I changed my implementation a little bit to avoid temp lists.

Thank you.

@dschult
Copy link
Member

dschult commented Feb 26, 2022

oops... my suggestion had quotes around the output string when it shouldn't have. I think taking out those quotes gets rid of the test failures.

@alifa98
Copy link
Contributor Author

alifa98 commented Mar 3, 2022

oops... my suggestion had quotes around the output string when it shouldn't have. I think taking out those quotes gets rid of the test failures.

I do not know what to do!!!?!

@dschult
Copy link
Member

dschult commented Mar 3, 2022

Take the single quotes out of line 508 where the output of the example appears as 'Graph with 12 nodes and 16 edges' when it should be Graph with 12 nodes and 16 edges

Copy link
Member

@dschult dschult left a comment

Choose a reason for hiding this comment

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

I have some minor typos in the docs, an extra line to name G and H, and a shorter assert line in the test (which matches the previous test's use of G.size() over G.number_of_edges().

With these changes I'm ready to approve it. Thanks very much!!

alifa98 and others added 3 commits March 5, 2022 15:08
Co-authored-by: Dan Schult <dschult@colgate.edu>
Co-authored-by: Dan Schult <dschult@colgate.edu>
`size()` is like the `number_of_edges()` method.

Co-authored-by: Dan Schult <dschult@colgate.edu>
Copy link
Member

@dschult dschult left a comment

Choose a reason for hiding this comment

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

Thanks!

Copy link
Member

@MridulS MridulS left a comment

Choose a reason for hiding this comment

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

Thanks @alifa98!

@MridulS MridulS merged commit 32c5923 into networkx:main Jul 5, 2022
MridulS pushed a commit to MridulS/networkx that referenced this pull request Feb 4, 2023
* Corona product implemented.
Todos:
Docs
Test for corona product

* Corona Product Added and Works Correctly now.

* document added.

* corona product test added

* corona product added to __all__

* add corona_product to operators.rst

* precommit format fixed

* Memory usage problem in the corona product improved

* Update networkx/algorithms/operators/product.py

Co-authored-by: Dan Schult <dschult@colgate.edu>

* temp list replaced with generators

* single qoutes problem in doc string

* doc clean up

Co-authored-by: Dan Schult <dschult@colgate.edu>

* doc clean up

Co-authored-by: Dan Schult <dschult@colgate.edu>

* Update Tests

`size()` is like the `number_of_edges()` method.

Co-authored-by: Dan Schult <dschult@colgate.edu>

Co-authored-by: Dan Schult <dschult@colgate.edu>
cvanelteren pushed a commit to cvanelteren/networkx that referenced this pull request Apr 22, 2024
* Corona product implemented.
Todos:
Docs
Test for corona product

* Corona Product Added and Works Correctly now.

* document added.

* corona product test added

* corona product added to __all__

* add corona_product to operators.rst

* precommit format fixed

* Memory usage problem in the corona product improved

* Update networkx/algorithms/operators/product.py

Co-authored-by: Dan Schult <dschult@colgate.edu>

* temp list replaced with generators

* single qoutes problem in doc string

* doc clean up

Co-authored-by: Dan Schult <dschult@colgate.edu>

* doc clean up

Co-authored-by: Dan Schult <dschult@colgate.edu>

* Update Tests

`size()` is like the `number_of_edges()` method.

Co-authored-by: Dan Schult <dschult@colgate.edu>

Co-authored-by: Dan Schult <dschult@colgate.edu>
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.

4 participants