[ https://issues.apache.org/jira/browse/FLINK2905?page=com.atlassian.jira.plugin.system.issuetabpanels:commenttabpanel&focusedCommentId=14980450#comment14980450
]
Martin Junghanns edited comment on FLINK2905 at 10/29/15 1:54 PM:

Hi, taking your reply on the mailing list into account, I wrote three versions of intersect
now :)
(1) Intersect On Edges (join based) as you suggested on the mailing list. Does not support
duplicate edges in the input graphs and outputs only one edge per matching pair!
(2) Intersect On Edges with duplicates (coGroup based). Supports duplicate edges and outputs
two edges for each matching pair in the input graphs (most flexible imho)
(3) Intersect On Vertices. Does the same as (2), but on vertices (which should be faster,
if the vertex set is much smaller than the edge set)
Please have a look at:
https://github.com/s1ck/flink/blob/FLINK2905/flinklibraries/flinkgelly/src/main/java/org/apache/flink/graph/Graph.java#L1482L1652
I also wrote some test cases, I think we should be on the same page with regard to the expected
output. Please have a look at:
https://github.com/s1ck/flink/blob/FLINK2905/flinklibraries/flinkgelly/src/test/java/org/apache/flink/graph/test/operations/GraphOperationsITCase.java#L360L703
Of course I will reduce the number of tests in the final version. I just wanted you to show
my expectation of the result.
was (Author: mju):
Hi, taking your reply on the mailing list into account, I wrote three versions of intersect
now :)
(1) Intersect On Edges (join based) as you suggested on the mailing list. Does not support
duplicate edges in the input graphs.
(2) Intersect On Edges with duplicates (coGroup based). Supports duplicate edges and outputs
two edges for each matching pair in the input graphs (most flexible imho)
(3) Intersect On Vertices. Does the same as (2), but on vertices (which should be faster,
if the vertex set is much smaller than the edge set)
Please have a look at:
https://github.com/s1ck/flink/blob/FLINK2905/flinklibraries/flinkgelly/src/main/java/org/apache/flink/graph/Graph.java#L1482L1652
I also wrote some test cases, I think we should be on the same page with regard to the expected
output. Please have a look at:
https://github.com/s1ck/flink/blob/FLINK2905/flinklibraries/flinkgelly/src/test/java/org/apache/flink/graph/test/operations/GraphOperationsITCase.java#L360L703
Of course I will reduce the number of tests in the final version. I just wanted you to show
my expectation of the result.
> Add intersect method to Graph class
> 
>
> Key: FLINK2905
> URL: https://issues.apache.org/jira/browse/FLINK2905
> Project: Flink
> Issue Type: New Feature
> Components: Gelly
> Affects Versions: 0.10
> Reporter: Martin Junghanns
> Assignee: Martin Junghanns
> Priority: Minor
>
> Currently, the Gelly Graph supports the set operations {{Graph.union(otherGraph)}} and
{{Graph.difference(otherGraph)}}. It would be nice to have a {{Graph.intersect(otherGraph)}}
method, where the resulting graph contains all vertices and edges contained in both input
graphs.

This message was sent by Atlassian JIRA
(v6.3.4#6332)
