You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by andralungu <gi...@git.apache.org> on 2015/05/15 09:08:17 UTC
[GitHub] flink pull request: [FLINK-2012][gelly] Added methods to remove/ad...
GitHub user andralungu opened a pull request:
https://github.com/apache/flink/pull/678
[FLINK-2012][gelly] Added methods to remove/add multiple edges/vertices
This pull request provides methods for adding/deleting more than one vertex/edge at a time.
The addEdges method is overloaded to treat the case when a user wants to add an existing set of edges.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/andralungu/flink addVertices
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/flink/pull/678.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #678
----
commit a6f5e98d40bee51552fc32e5d034b397b9b51c58
Author: andralungu <lu...@gmail.com>
Date: 2015-05-15T07:03:35Z
[FLINK-2012][gelly] Added methods to remove/add multiple edges/vertices
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] flink pull request: [FLINK-2012][gelly] Added methods to remove/ad...
Posted by vasia <gi...@git.apache.org>.
Github user vasia commented on the pull request:
https://github.com/apache/flink/pull/678#issuecomment-105014574
Hi @andralungu,
I think that mixing DataSet with List is not the way to go. When would one end up with a DataSet of vertices, but just a list of Edges (given that edges are usually more than vertices)? On the other hand, we have to deal with the empty edge case as you said. Actually, I think that `addVertex` / `addVertices` shouldn't deal with the edges at all -- having an argument for edges kind of implies that we're checking that these edges belong to the vertex/vertices to be added.. which we don't.
Let me propose the following:
- regarding additions: when we have DataSets, simply use `union`. `addVertex` adds a single vertex and `addVertices` adds a list of vertices to the graph (no edges as an argument). `addEdge` and `addEdges` work the same way: single edge and list of edges. The only thing we need to decide here is the behavior when adding an edge for a non-existing vertex. We can either ignore the edge or create it with some default value.
- regarding removals: I propose we add a `difference` method, corresponding to `union`, which will work on DataSets. Methods for removing vertices and edges will work on single objects and lists.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] flink pull request: [FLINK-2012][gelly] Added methods to remove/ad...
Posted by vasia <gi...@git.apache.org>.
Github user vasia commented on the pull request:
https://github.com/apache/flink/pull/678#issuecomment-103574952
Thanks for this PR @andralungu!
There are a few things we need to consider here I think:
- when to have a `DataSet` argument and when to have a `List`. For example, `addVertices` receives a `DataSet` of vertices to add, but a `List` of edges, `addEdges` receives two datasets...
- do we really need two `addEdges` methods? If I understand correctly, the second `addEdges` method is to be used when the new edges connect existing vertices? What will (should) happen if there are edges with invalid ids (not in the vertex set)?
- could we maybe have only `addVertices`, `removeVertices`, `addEdges` etc. methods to cover also the single addition/deletion cases?
- the remove methods implementations can be simplified by using a single coGroup: if only the first group (existing vertices) contains an element you keep it, otherwise if both groups contain it you remove it (you are actually emulating this with the tag+union+reduce :)).
What do you think?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] flink pull request: [FLINK-2012][gelly] Added methods to remove/ad...
Posted by andralungu <gi...@git.apache.org>.
Github user andralungu commented on the pull request:
https://github.com/apache/flink/pull/678#issuecomment-105311774
Yes, I got the idea of difference, we agree on the functionality. What I was trying to say is that it cannot be used in the remove* methods as it needs to create a graph from an empty vertex set and that is impossible.
If we want a difference method we should open a separate JIRA for that :)
Tell me if I need to add anything else to this. Suggestion-wise, I think it's pretty balanced ^^
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] flink pull request: [FLINK-2012][gelly] Added methods to remove/ad...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/flink/pull/678
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] flink pull request: [FLINK-2012][gelly] Added methods to remove/ad...
Posted by rmetzger <gi...@git.apache.org>.
Github user rmetzger commented on the pull request:
https://github.com/apache/flink/pull/678#issuecomment-102299465
Looks good (+1 for updating the docs and having tests ;) )
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] flink pull request: [FLINK-2012][gelly] Added methods to remove/ad...
Posted by vasia <gi...@git.apache.org>.
Github user vasia commented on the pull request:
https://github.com/apache/flink/pull/678#issuecomment-105641949
will merge!
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] flink pull request: [FLINK-2012][gelly] Added methods to remove/ad...
Posted by vasia <gi...@git.apache.org>.
Github user vasia commented on the pull request:
https://github.com/apache/flink/pull/678#issuecomment-105287317
Hey @andralungu,
first of all, you can always discuss implementation details by starting a thread in the mailing list. This is usually done for bigger changes, so that we can all agree before we start coding, instead of discovering disagreements during review. For small changes like this one, you can simply discuss implementation on the corresponding JIRA if you want or go ahead and implement the change and wait for the review :)
Second, my suggestions here are merely that: suggestions :) If you feel that what I'm suggesting doesn't make sense or you have a better idea, please discuss your view first before you start coding!
Regarding compatibility, if a method is badly designed or can be improved, now is the time to fix it. Gelly is not even released yet, so -fortunately- we still have the time to improve things :)
Finally, regarding the `difference` method, I meant a method that computes the difference of two graphs and returns a new graph containing the vertices and edges that the input graphs don't have in common. The idea is that when the user is dealing with lots of vertices / edges (DataSets), they can use `union` for additions and `difference` for removals. When the vertices / edges to be added / removed fit in a List, then the user can use the add/remove methods. Makes sense?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] flink pull request: [FLINK-2012][gelly] Added methods to remove/ad...
Posted by vasia <gi...@git.apache.org>.
Github user vasia commented on the pull request:
https://github.com/apache/flink/pull/678#issuecomment-105429495
Great!
+1 for opening a separate issue for `difference` and big +1 for remembering to use @ForwardedFields :))
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] flink pull request: [FLINK-2012][gelly] Added methods to remove/ad...
Posted by andralungu <gi...@git.apache.org>.
Github user andralungu commented on the pull request:
https://github.com/apache/flink/pull/678#issuecomment-103862850
Hi @vasia ,
I will address your comments one by one :)
- the addVertices method receives a List of Edges instead of a DataSet of Edges because you need to also consider the case when the edge list is empty. You cannot perform this operation on a DataSet as far as I know, at least not yet! I'm open to suggestions.
- the extra addEdges method was just an "experiment" it's not really needed. I removed it!
- addVertices can easily cover the addVertex case, however, I believe we should have both methods because there are situations (see IncrementalSSSP) when a user would like to detele a single vertex/edge. He/she will receive the src/target/value as a parameter. Then instead of just calling addEdge(), he/she will need to create a DataSet from the input. Sure, it's not rocket science, but why force the user to perform an extra step, when we have the power to do that for him/her?
- finally, for the remove methods, coGroup was my first idea but then I thought: "hey, I could try to make this faster" :)). I updated the functions!
Tell me what you think!
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] flink pull request: [FLINK-2012][gelly] Added methods to remove/ad...
Posted by andralungu <gi...@git.apache.org>.
Github user andralungu commented on the pull request:
https://github.com/apache/flink/pull/678#issuecomment-102301712
Well that was embarrassing ^^. Excellent catch @rmetzger! The code was written yesterday evening during a plane ride; My tests found a bug and I basically put that there to reming myself that I need to fix it this morning. Should have added a reminder to also delete reminder comments ;)
Thanks for the review!
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] flink pull request: [FLINK-2012][gelly] Added methods to remove/ad...
Posted by andralungu <gi...@git.apache.org>.
Github user andralungu commented on the pull request:
https://github.com/apache/flink/pull/678#issuecomment-105277029
Hi @vasia,
I updated the addition methods to fit your suggestion. Feedback, for both of us in the future: discuss implementation details like just add vertices and remove the list of edges before the code is written. 98% of the people would have kept the edge list for compatibility with the addVertex method that we already had.
Regarding edge/vertex removal, I just changed the arg to List. A difference operator will not do us any good for various reasons:
- that worked for union because the DataSet also had an union operator
- fromCollection() will never take an empty data set as a parameter so when you do removeVertices, you cannot use the difference operator. Workaround: generate an empty set by adding and removing an element. But really?
- when doing a "difference" on the vertices, you also need to remove the edges for which the vertex that disappeared was either source or target, so you will return a graph not a DataSet of vertices like is the case for union. Therefore a difference that operates on vertex data sets and returns a graph is exactly my removeVertices(). I guess you wanted to have Graph difference(graph) - back to argument 2.
Could you describe what you meant by a difference similar to union in more detail?
Thanks!
Andra
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] flink pull request: [FLINK-2012][gelly] Added methods to remove/ad...
Posted by rmetzger <gi...@git.apache.org>.
Github user rmetzger commented on a diff in the pull request:
https://github.com/apache/flink/pull/678#discussion_r30390037
--- Diff: flink-staging/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphMutationsITCase.java ---
@@ -271,4 +605,31 @@ public void testRemoveInvalidEdge() throws Exception {
"4,5,45\n" +
"5,1,51\n";
}
+
+ //!!!!!BUG!!!! Daca ii dai invalid edge, ii face union...
--- End diff --
?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---