Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: subgraph_centrality() now ignores edge directions #1414

Merged
merged 8 commits into from
Jul 2, 2024

Conversation

szhorvat
Copy link
Member

@szhorvat szhorvat commented Jun 21, 2024

The method that this function uses does not work in general for directed graphs, and the concept of subgraph centrality is normally defined for undirected graphs only.


I consider this a bugfix, so I don't think any lifecycle work is necessary. A revdepcheck will be useful, as some users may have tried to use this for directed graphs (in which case the function wouldn't return meaningful results, as already indicated in its documentation).

Please consider including this simple fix in the next release.

@szhorvat szhorvat added this to the 2.0.4 milestone Jun 21, 2024
Copy link
Contributor

aviator-app bot commented Jun 21, 2024

Current Aviator status

Aviator will automatically update this comment as the status of the PR changes.
Comment /aviator refresh to force Aviator to re-examine your PR (or learn about other /aviator commands).

This PR was merged using Aviator.


See the real-time status of this PR on the Aviator webapp.
Use the Aviator Chrome Extension to see the status of your PR within GitHub.

@szhorvat
Copy link
Member Author

@maelle Please have a look at how I access functions from the Matrix library in the test. Is this the customary way in tests?

@szhorvat szhorvat force-pushed the fix/subgraph_centrality branch 3 times, most recently from 2523a35 to 2f6161f Compare June 27, 2024 19:13
@krlmlr krlmlr requested a review from maelle July 2, 2024 08:54
Copy link
Contributor

@krlmlr krlmlr left a comment

Choose a reason for hiding this comment

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

@maelle, can you please take another look and approve if good?

R/centrality.R Show resolved Hide resolved
@@ -0,0 +1,24 @@
test_that("subgraph_centrality works", {
g <- make_graph("Frucht")
Copy link
Contributor

Choose a reason for hiding this comment

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

I'll make a commit to rename those to not re-use names which is a pet peeve of mine 😇 https://masalmon.eu/2024/05/23/refactoring-tests/

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't understand what you mean.

Copy link
Contributor

Choose a reason for hiding this comment

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

In the test two objects were created with the name "g". I prefer the two names to be different.

Copy link
Member Author

@szhorvat szhorvat Jul 2, 2024

Choose a reason for hiding this comment

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

I see what you mean after looking at your commits, but keep in mind that there is no special significance to this being the Frucht graph here. If all you need is to not reassign g, I suggest g1 and g2 for similar situations in the future. Then the variable doesn't need to be renamed when the graph is changed.

The reason why mathematicians don't spell out variable names is not that they don't know any better. It's because sometimes it is useful to be generic and not be distracted by things that are irrelevant to the work at hand.

Copy link
Contributor

Choose a reason for hiding this comment

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

Fair enough, but with g1 and g2 I'd easily get confused. They can be uninformative but they have to be really different for me 😁

Copy link
Contributor

@maelle maelle left a comment

Choose a reason for hiding this comment

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

made a few mostly cosmetic changes 💅

szhorvat and others added 8 commits July 2, 2024 09:14
The method that this function uses does not work in general for directed graphs, and the concept of subgraph centrality is normally defined for undirected graphs only.
The method that this function uses does not work in general for directed graphs, and the concept of subgraph centrality is normally defined for undirected graphs only.
Co-authored-by: Kirill Müller <[email protected]>
@aviator-app aviator-app bot merged commit 68fa712 into main Jul 2, 2024
20 checks passed
@aviator-app aviator-app bot deleted the fix/subgraph_centrality branch July 2, 2024 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants