-
Notifications
You must be signed in to change notification settings - Fork 15
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
Enable simplification of multi-relation edges & make multi-network construction work with igraph version 2.0.1.1 #250
Conversation
Can you please elaborate on this, and give an example of what changed? This may not be an intentional change. |
Thanks for having a look at our pull request @szhorvat 😄 Sure, I will elaborate on this: Up until now, we used the "+" operator and graph + igraph::vertices(vertices.to.add, type = type.of.the.vertices.to.add)
As I assumed that |
ed11f29
to
23e9370
Compare
This fixes se-sic#246. Signed-off-by: Thomas Bock <bockthom@cs.uni-saarland.de>
23e9370
to
74dde66
Compare
This can either be done manually when calling 'simplify.network' or automatically at network creation via a new network configuration parameter 'simplify.multiple.relations'. Signed-off-by: Thomas Bock <bockthom@cs.uni-saarland.de>
Since we now have issue artifact networks, the 'artifact.directed' parameter now is effective for issue artifact networks. Signed-off-by: Thomas Bock <bockthom@cs.uni-saarland.de>
When adding an empty set of artifact vertices to the multi-network, adding 'no' vertex fails as of igraph 2.0.1.1. This is easily fixed by checking whether the set of arftiact vertices to add is empty, and then just don't call the add function if it is empty. Signed-off-by: Thomas Bock <bockthom@cs.uni-saarland.de>
This change is a preparation for the release of R version 4.4, which might become available in the next months and will be covered by R-latest then. To include R version 4.3 in our CI pipeline, it needs to be explicitly stated. Signed-off-by: Thomas Bock <bockthom@cs.uni-saarland.de>
74dde66
to
d9fd5a9
Compare
@szhorvat I just encountered another problem in our failing tests which is also related to author.net =
igraph::make_empty_graph(n = 0, directed = FALSE) +
igraph::vertices("A", "B", "C", type = "author", kind = "author") +
igraph::edges("A", "A", type = "intra", relation = "mail") In previous versions of igraph, this did not fail. However, with the current igraph version, this fails: What I figured out now is the following: Previously, the attributes have automatically been expanded. That is, if I add 3 vertices but the type attribute contains only one element, then the type-attribute vector was automatically expanded and added as an attribute to each added vertex. Now, the code is failing if the attribute vector is not equal to the number of added vertices. (This might also be the problem in the example that I stated some hours ago, where the attribute vector had length one but zero vertices should be added). |
So it seems that the problem is that if the number of attribute values provided does not match the number of vertices or edges added, then there's an error, even if a single attribute value was given. This works:
This does not work, and rightfully so:
But one might expect this to assign na attribute value of
Am I understanding you correctly? Pinging @krlmlr to ask if this is indeed expected. |
Correct.
Sure, this should work.
Agreed, this should not work.
Yes, I totally agree with your understanding.
I am not sure if the behavior with regard to multiple vertices and a single-element attribute vector was expected in past versions of igraph - but it was a nice convenience feature to add multiple vertices at once that should all have the same vertex attributes - then passing just one value for each attribute is much more readable and faster to write than extending all the vectors for all attributes to the number of vertices to add. We used this feature of igraph in our test suite for more than 6 years already. But if you think that this should be changed, it is easy to fix on our side. Nevertheless, I'd also be glad if you can restore the previous behavior in igraph 😉 |
With igraph 1.6.0: options(conflicts.policy = list(warn = FALSE))
library(igraph)
g <-
make_empty_graph(1) +
vertices("a", "b", foo = 5)
V(g)$foo
#> [1] NA 5 5 Created on 2024-02-09 with reprex v2.1.0 We clearly had no tests for this, and I agree that this is idiomatic to R. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good thank you @bockthom
I will merge this now
PR se-sic#250 introduces the 'simplify.multiple.relations' configuration option, which can alter the edge-simplification algorithm for multi-networks. Correspondingly, the edge-attribute handling does need adjustment to work with this configuration option. Disambiguate and sort the 'relation' edge-attribute when simplifying multi-networks with the 'simplify.multiple.relations' option set. This works towards se-sic#251. Signed-off-by: Maximilian Löffler <s8maloef@stud.uni-saarland.de>
PR se-sic#250 introduces the 'simplify.multiple.relations' configuration option, which can alter the edge-simplification algorithm for multi-networks. Correspondingly, the edge-attribute handling does need adjustment to work with this configuration option. Disambiguate and sort the 'relation' edge-attribute when simplifying multi-networks with the 'simplify.multiple.relations' option set. This works towards se-sic#251. Signed-off-by: Maximilian Löffler <s8maloef@stud.uni-saarland.de>
Prerequisites
showcase.R
with respect to my changes.dev
.Description
This PR addresses multiple issues:
metrics.smallwordness
is broken #246 (i.e., fixes a broken logerror statement)Changelog
Added
Changed/Improved
Fixed
metrics.smallworldness
(03e0688)