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

test: test-conversion #1539

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

test: test-conversion #1539

wants to merge 8 commits into from

Conversation

maelle
Copy link
Contributor

@maelle maelle commented Sep 30, 2024

No description provided.

@maelle maelle added the upkeep maintenance, infrastructure, and similar label Sep 30, 2024
Copy link
Contributor

aviator-app bot commented Sep 30, 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 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.

expect_identical(colnames(I2), c("h", "i", "j", "k", "l"))
})

test_that("as_biadjacency_matrix() works -- dense + attribute", {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@szhorvat does this test make any sense? It's also needed for #1518

Copy link
Member

Choose a reason for hiding this comment

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

The C core will not support adjacency matrices that contain other values than numbers. This means that we either need to drop support for character adjacency matrices, or we need to implement this behaviour in pure R while making sure to match the C core.

There are several things that don't make much sense with non-numerical adjacency matrices. For example, what do you do with multi-edges? How do you combine their character properties? For plain adjacency matrices, what do you do with self-loops in undirected graphs (whose value is normally doubled in the matrix)?

I'm sure we had a discussion about this in the past, and even reached out to someone who used character matrices (very few people do). But I don't remember the decision. We need to search the issue tracker.

Copy link
Member

Choose a reason for hiding this comment

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

Having the string "0" for non-existent edges makes no sense to make. Numbers should be numbers and strings should be strings—R is not Perl! 😆

If we really want to support string matrices, wouldn't "" make a lot more sense?

The question of what is the "null strings" also ties into what w do with self-loops and multi-edges. If the multi-edge combiner operation is string concatenation, then the null string is "".

These complications illustrate why I don't particularly like the idea of supporting string matrices.

Copy link
Member

Choose a reason for hiding this comment

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

I suggest aiming to remove string matrix support, and not producing characterization tests for it. Issue: #1542

@maelle
Copy link
Contributor Author

maelle commented Sep 30, 2024

See also #1540

})

test_that("as_biadjacency_matrix() works -- dense", {
I <- matrix(sample(0:1, 35, replace = TRUE, prob = c(3, 1)), ncol = 5)
Copy link
Member

Choose a reason for hiding this comment

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

Minor nitpick: Let's not call this I, as that's the standard name for the identity matrix. (It was probably called I because of "incidence" matrix.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

and good to merge once I fix that?

Copy link
Member

Choose a reason for hiding this comment

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

This part is good, and this is just an aesthetic nitpick that doesn't necessarily need to be fixed. My main comments are in the other thread in this PR, addressing string matrices. Will open an issue for that soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upkeep maintenance, infrastructure, and similar
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants