[ 
https://issues.apache.org/jira/browse/FLINK-2905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14980450#comment-14980450
 ] 

Martin Junghanns commented on FLINK-2905:
-----------------------------------------

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/FLINK-2905/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L1482-L1652

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/FLINK-2905/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphOperationsITCase.java#L360-L703

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: FLINK-2905
>                 URL: https://issues.apache.org/jira/browse/FLINK-2905
>             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)

Reply via email to