[ https://issues.apache.org/jira/browse/FLINK-2905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14988155#comment-14988155 ]
Martin Junghanns edited comment on FLINK-2905 at 11/4/15 7:11 AM:
------------------------------------------------------------------
Hi [~vkalavri],
thanks for your comments! I removed the {{intersectOnVertices}} and combined (1) and (2) in one method. I also realized, that there is no need to union-distinct the vertex sets as the edge intersection guarantees, that source and target vertices are contained in both input graphs.
I was thinking about the optimization when vertices have no associated values. Imho, during runtime, we cannot determine the type of the vertex value. My idea was to add an UDF for vertex initialization as additional argument. If the argument is not null, it will be used for vertex value initialization, if it is null, vertex values are determined from the input vertex sets. A problem with this approach is that the result of the UDF needs to be of the same type as the vertex value of the input graphs. Do you see a better approach for that? The code is available at https://github.com/s1ck/flink/blob/FLINK-2905/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L1499-L1550
was (Author: mju):
Hi [~vkalavri],
thanks for your comments! I removed the {{intersectOnVertices}} and combined (1) and (2) in one method. I also realized, that there is no need to union-distinct the vertex sets as the edge intersection guarantees, that source and target vertices are contained in both input graphs.
I was thinking about the optimization when vertices have no associated values. Imho, during runtime, we cannot determine the type of the vertex value. My idea was to add an UDF for vertex initialization as additional argument. If the argument is not null, it will be used for vertex value initialization, if it is null, vertex values are determined from the input vertex sets. A problem with this approach is that the result of the UDF needs to be of the same type as the vertex value of the input graphs. Do you see a better approach for that? The code is available at https://github.com/s1ck/flink/blob/b336271b830d8ac2e065e9c56a54983a8f48a794/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L1518
> 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)