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

feat: Split sample_bipartite() into two functions for the G(n, m) a… #1692

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

maelle
Copy link
Contributor

@maelle maelle commented Feb 19, 2025

…nd G(n, p) case

Fix #630

@Antonov548 could you please help me update Stimulus to get the functions as they are now in aaa-auto.R?

Copy link
Contributor

aviator-app bot commented Feb 19, 2025

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 pull request is currently open (not queued).

How to merge

To merge this PR, comment /aviator merge or add the mergequeue label.


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.

on.exit( .Call(R_igraph_finalizer) )
# Function call
res <- .Call(R_igraph_bipartite_game_gnp, n1, n2, p, directed, mode)
res <- set_vertex_attr(res$graph, "type", value = res$types)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Antonov548 I mean this line in this and the other function. Furthermore there should be NO

  if (igraph_opt("add.vertex.names") && is_named(graph)) {
    names(res) <- vertex_attr(graph, "name")
  }
  

Thanks!

Copy link
Contributor

@Antonov548 Antonov548 Feb 20, 2025

Choose a reason for hiding this comment

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

Hello @maelle

I just took a look how to update generation to match with existing code. It is just first time we setting vertex attribute in generated interface.

I think I understand why names(res$types) <- vertex_attr(graph, "name", V(graph)) is not needed, but do we really need to set_vertex_attr()? I just trying to understand it in order to decide how to update stimulus part.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @Antonov548 maybe we could add set_vertex_attr() in the not automatic code. Let me discuss this with @krlmlr and @schochastics and then I'll update this thread (within the next few weeks). Thank you.

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we could add set_vertex_attr() in the not automatic code.

Good. To be honest I think not automatic code maybe it better place for setting up the attributes. I will wait for the decision.

Copy link
Contributor

Choose a reason for hiding this comment

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

If we change in the template, how many functions will be affected?

@Antonov548: Can you please adapt the template and run the generation? We can revert later if needed.

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.

Thanks, let's iterate again.

on.exit( .Call(R_igraph_finalizer) )
# Function call
res <- .Call(R_igraph_bipartite_game_gnp, n1, n2, p, directed, mode)
res <- set_vertex_attr(res$graph, "type", value = res$types)
Copy link
Contributor

Choose a reason for hiding this comment

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

If we change in the template, how many functions will be affected?

@Antonov548: Can you please adapt the template and run the generation? We can revert later if needed.

R/games.R Outdated
}

utils::globalVariables("type")
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks odd.

)
bipartite_gnm(...)
} else {
cli::cli_abort(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this would be the case where the user passes sthg else than NULL, "gnp" or gnm"."

@krlmlr
Copy link
Contributor

krlmlr commented Mar 6, 2025

A few comments here need addressing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Split sample_bipartite() into two functions for the G(n,m) and G(n,p) case
3 participants