-
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
Fix edge-attribute handling when simpliyfing networks #251
Comments
I have implemented a simple disambiguation of the |
I've never used
Hm, I am not convinced yet. In the case mentioned above, the following line returns different values in different cases: data.sources = unique(igraph::E(network)$relation) If every edge represents a single relation, then |
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>
As the 'relation' edge-attribute potentially holds a list of relation sources, it needs to be unlisted first before it can be disambiguated. This works towards se-sic#251. Signed-off-by: Maximilian Löffler <s8maloef@stud.uni-saarland.de>
Oh by the way, I have fixed that one function affected by the changes to the relation attribute. I forgot that pushes to that branch do not notify anyone of you, but please look at this to oversee the fix. I have started to working on tests for the new simplification and will let you know more details in our next meeting 😄 |
I had a quick look at the last two commits on the referenced branch. Looks good to me! |
Im not entirely sure, I understand what you mean. Obviously, we cannot move If I assumed correctly: I used |
Why not? I don't see any situation at which changing the definition of |
Well I supposed when simplifying multi-relational networks the classical way, but upon looking at the code, I think it would retain functionality. Apart from that, Lines 910 to 915 in a0c3a52
I am not sure on the effects of changing the |
According to the documentation of |
As the 'relation' edge-attribute can only be singular values if 'simplify.multiple.relations' is not set, we can set the previously introduced lambda as default. 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>
As the 'relation' edge-attribute potentially holds a list of relation sources, it needs to be unlisted first before it can be disambiguated. This works towards se-sic#251. Signed-off-by: Maximilian Löffler <s8maloef@stud.uni-saarland.de>
As the 'relation' edge-attribute can only be singular values if 'simplify.multiple.relations' is not set, we can set the previously introduced lambda as default. This works towards se-sic#251. Signed-off-by: Maximilian Löffler <s8maloef@stud.uni-saarland.de>
In PR #250, we introduce a new possibility for simplifying multi-relation edges. However, there are no tests yet for this new feature, and also the edge-attribute handling still needs to be adjusted accordingly. Hence, in this issue, I describe the missing steps that should be approached after PR #250 is merged:
Let me start with an example:
Assume that we have an author network containing two vertices A and B, which has multiple relations, namely "mail" and "cochange". Assume that there are three cochange edges and four mail edges between A and B.
Then the default simplification reduced the three cochange edges to one cochange edge, and the four mail edges to one mail edge. The new "simplify.multiple.relations" parameter instead simplifies the three cochange and four mail at edges to one single edges that represents all mail and cochange edges together.
Problem: Edge attributes need to be handled properly for the new case. The edge-attribute handling for simplification is specified here:
coronet/util-networks.R
Lines 55 to 70 in a0c3a52
Currently, we only take the "first" relation - which was not a problem, was only edges of the same relation were simplified to one edge. Now, when we simplify edges of different relations to the same edge, "first" is wrong, as we need a unique vector of all relations instead of just taking the first one. Unfortunately, the edge-attribute handling of igraph does not provide a dedicated function for that. However, igraph allows to provide a custom function that is applied when handling edge attributes during simplification. Hence, such a custom function is necessary for relation here.
However, changing the edge-attribute handling will also break some other parts of coronet, which assume that the edge attribute relation are only a single element - but now it also can be a vector. For example, this might break the following lines, in which the data sources are determined from the relations - this might break if there are vectors of relations instead of single elements:
coronet/util-networks.R
Lines 1673 to 1689 in a0c3a52
It is important, that the new functionality is backwards compatible, this is, if the default simplification procedure is used, then everything should work as before, and only if there are multiple relations combined into a single edge, we need to find a way that all the functions are also able to deal with a vector of relations instead of a single edge.
In addition, PR #250 also lacks of tests. So proper tests should also be added 😉
The text was updated successfully, but these errors were encountered: