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

Bugfix: make Louvain implementation in network_p2p() deterministic (#221) #222

Merged
merged 1 commit into from May 30, 2022

Conversation

martinctc
Copy link
Member

@martinctc martinctc commented May 30, 2022

Summary

This branch fixes a bug reported in #221 where the Louvain implementation in network_p2p() cannot be made deterministic.

Changes

The changes made in this PR are:

  1. Expands the ability to set seed within the function environment with the seed argument in network_p2p() to when display = "louvain" (previously only affects display = "leiden").
  2. Update relevant documentation.

Validation

This fix is confirmed to be working with:

library(wpa)

p2p_data <- p2p_data_sim()

a <- 
  p2p_data %>%
  network_p2p(
    display = "louvain",
    return = "table",
    seed = 100
  )

b <- 
  p2p_data %>%
  network_p2p(
    display = "louvain",
    return = "table",
    seed = 100
  )

nrow(a) == nrow(b)

all(a$cluster == b$cluster)

Checks

  • All R CMD checks pass
  • roxygen2::roxygenise() has been run prior to merging to ensure that .Rd and NAMESPACE files are up to date.
  • NEWS.md has been updated.

Notes

This fixes #221.

@martinctc martinctc added the bug Something isn't working label May 30, 2022
@martinctc martinctc self-assigned this May 30, 2022
@martinctc martinctc marked this pull request as ready for review May 30, 2022 11:06
@martinctc martinctc requested a review from moralec May 30, 2022 11:08
@martinctc martinctc merged commit 2a6bd72 into main May 30, 2022
@martinctc martinctc deleted the fix/make-louvain-deterministic branch May 30, 2022 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to set seed for louvain clustering in network_p2p()
1 participant