[
https://issues.apache.org/jira/browse/FLINK-1726?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14377631#comment-14377631
]
ASF GitHub Bot commented on FLINK-1726:
---------------------------------------
Github user vasia commented on a diff in the pull request:
https://github.com/apache/flink/pull/505#discussion_r27016738
--- Diff:
flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/example/SimpleCommunityDetectionExample.java
---
@@ -0,0 +1,159 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.graph.example;
+
+import org.apache.flink.api.common.ProgramDescription;
+import org.apache.flink.api.common.functions.MapFunction;
+import org.apache.flink.api.java.DataSet;
+import org.apache.flink.api.java.ExecutionEnvironment;
+import org.apache.flink.api.java.tuple.Tuple2;
+import org.apache.flink.api.java.tuple.Tuple3;
+import org.apache.flink.graph.Edge;
+import org.apache.flink.graph.Graph;
+import org.apache.flink.graph.Vertex;
+import org.apache.flink.graph.example.utils.SimpleCommunityDetectionData;
+import org.apache.flink.graph.library.SimpleCommunityDetection;
+
+/**
+ * This example shows how to use the {@link
org.apache.flink.graph.library.SimpleCommunityDetection}
+ * library method:
+ * <ul>
+ * <li> with the edge data set given as a parameter
+ * <li> with default data
+ * </ul>
+ */
+public class SimpleCommunityDetectionExample implements ProgramDescription
{
+
+ public static void main(String [] args) throws Exception {
+
+ if(!parseParameters(args)) {
+ return;
+ }
+
+ // set up the execution environment
+ ExecutionEnvironment env =
ExecutionEnvironment.getExecutionEnvironment();
+
+ // set up the graph
+ DataSet<Edge<Long, Double>> edges = getEdgesDataSet(env);
+ DataSet<Vertex<Long, Tuple2<Long, Double>>> vertices =
assignInitialVertexValues(edges);
+ Graph<Long, Tuple2<Long, Double>, Double> graph =
Graph.fromDataSet(vertices, edges, env);
+
+ // set up the program
+ Graph<Long, Tuple2<Long, Double>, Double> communityGraph =
--- End diff --
Instead of "extracting" the community from the vertex value in order to
return it, I'd rather have `run` return the graph where the vertices have the
community label as a value, instead of the `Tuple2`.
> Add Community Detection Library and Example
> -------------------------------------------
>
> Key: FLINK-1726
> URL: https://issues.apache.org/jira/browse/FLINK-1726
> Project: Flink
> Issue Type: Task
> Components: Gelly
> Affects Versions: 0.9
> Reporter: Andra Lungu
> Assignee: Andra Lungu
>
> Community detection paper: http://arxiv.org/pdf/0808.2633.pdf
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)