Skip to content

PR for issue #6033 Improve test coverage for algorithms in betweenness_subset.py #6033#6083

Merged
MridulS merged 8 commits intonetworkx:mainfrom
ladykkk:dev/v1
Nov 14, 2022
Merged

PR for issue #6033 Improve test coverage for algorithms in betweenness_subset.py #6033#6083
MridulS merged 8 commits intonetworkx:mainfrom
ladykkk:dev/v1

Conversation

@ladykkk
Copy link
Copy Markdown
Contributor

@ladykkk ladykkk commented Oct 16, 2022

PR for issue #6033 Improve test coverage for algorithms in betweenness_subset.py #6033
Updated test_betweenness_centrality_subset.py

@ladykkk
Copy link
Copy Markdown
Contributor Author

ladykkk commented Oct 16, 2022

Hi @MridulS can you please review this PR for #6033 Improve test coverage for algorithms in betweenness_subset.py? Thanks.

for n in sorted(G):
assert b[n] == pytest.approx(b_answer[n], abs=1e-7)

def test_weighted_graph(self):
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.

Where was the weighted test case derived? Did you compute this by hand or was this adapted from one of the other cases?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hi @rossbar thank you so much for the review:) As a first contributor here, I read many of the relevant codes of betweenness and betweenness subset in networkx. The weighted test case I used here is as same as the one in both test_load_centrality.py and test_betweenness_centrality.py and I calculated the betweenness centrality by myself. Previously I thought it was the sample of weighted graph. I will initialize a new weighted graph if it cannot be used here.

for n in sorted(G):
assert b[n] == pytest.approx(expected_b[n], abs=1e-7)

def test_normalized_p2(self):
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.

It might be worth adding a docstring here to indicate what the test is designed to cover; i.e. the special case when n<=2 where the betweenness centrality should always be 0.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you so much for the suggestion:) I have updated the docstring.

@rossbar rossbar added the outreachy-review A temp label to help reviewers organize outreachy PRs for review label Nov 10, 2022
Copy link
Copy Markdown
Contributor

@rossbar rossbar left a comment

Choose a reason for hiding this comment

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

Thanks @ladykkk , this LGTM!

@MridulS MridulS merged commit 4376a6f into networkx:main Nov 14, 2022
@jarrodmillman jarrodmillman added this to the networkx-3.0 milestone Jan 6, 2023
MridulS pushed a commit to MridulS/networkx that referenced this pull request Feb 4, 2023
…tweenness_subset.py networkx#6033 (networkx#6083)

* Updated test_betweenness_centrality_subset.py

* add test of normalized in test_betweenness_centrality_subset.py

* add test of normalized in test_betweenness_centrality_subset.py

* update test of normalized in test_betweenness_centrality_subset.py

* update weight of test_betweenness_centrality_subset.py

* add docstring

* add docstring in test_betweenness_centrality_subset.py

* add docstring in test_betweenness_centrality_subset.py
Mjh9122 pushed a commit to Mjh9122/networkx that referenced this pull request Feb 27, 2023
…tweenness_subset.py networkx#6033 (networkx#6083)

* Updated test_betweenness_centrality_subset.py

* add test of normalized in test_betweenness_centrality_subset.py

* add test of normalized in test_betweenness_centrality_subset.py

* update test of normalized in test_betweenness_centrality_subset.py

* update weight of test_betweenness_centrality_subset.py

* add docstring

* add docstring in test_betweenness_centrality_subset.py

* add docstring in test_betweenness_centrality_subset.py
cvanelteren pushed a commit to cvanelteren/networkx that referenced this pull request Apr 22, 2024
…tweenness_subset.py networkx#6033 (networkx#6083)

* Updated test_betweenness_centrality_subset.py

* add test of normalized in test_betweenness_centrality_subset.py

* add test of normalized in test_betweenness_centrality_subset.py

* update test of normalized in test_betweenness_centrality_subset.py

* update weight of test_betweenness_centrality_subset.py

* add docstring

* add docstring in test_betweenness_centrality_subset.py

* add docstring in test_betweenness_centrality_subset.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

outreachy-review A temp label to help reviewers organize outreachy PRs for review

Development

Successfully merging this pull request may close these issues.

4 participants