flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-1883) Add Min Vertex ID Propagation Library Method and Example
Date Sat, 18 Apr 2015 15:50:58 GMT

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

ASF GitHub Bot commented on FLINK-1883:
---------------------------------------

Github user vasia commented on a diff in the pull request:

    https://github.com/apache/flink/pull/596#discussion_r28645013
  
    --- Diff: flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/library/ConnectedComponents.java
---
    @@ -0,0 +1,90 @@
    +/*
    + * 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.library;
    +
    +import org.apache.flink.graph.Graph;
    +import org.apache.flink.graph.GraphAlgorithm;
    +import org.apache.flink.graph.spargel.MessageIterator;
    +import org.apache.flink.graph.spargel.MessagingFunction;
    +import org.apache.flink.graph.spargel.VertexUpdateFunction;
    +import org.apache.flink.types.NullValue;
    +
    +/**
    + * Connected components algorithm.
    + *
    + * Initially, each vertex will have its own ID as a value(is its own component). The
vertices propagate their
    + * current component ID in iterations, each time adopting a new value from the received
neighbor IDs,
    + * provided that the value is less than the current minimum.
    + *
    + * The algorithm converges when vertices no longer update their value or when the maximum
number of iterations
    + * is reached.
    + */
    +@SuppressWarnings("serial")
    +public class ConnectedComponents implements GraphAlgorithm<Long, Long, NullValue>{
    +
    +	private Integer maxIterations;
    +
    +	public ConnectedComponents(Integer maxIterations) {
    +		this.maxIterations = maxIterations;
    +	}
    +
    +	@Override
    +	public Graph<Long, Long, NullValue> run(Graph<Long, Long, NullValue> graph)
throws Exception {
    +
    +		Graph<Long, Long, NullValue> undirectedGraph = graph.getUndirected();
    +
    +		// initialize vertex values and run the Vertex Centric Iteration
    +		return undirectedGraph.runVertexCentricIteration(new CCUpdater(),
    +				new CCMessenger(), maxIterations);
    +	}
    +
    +	/**
    +	 * Updates the value of a vertex by picking the minimum neighbor ID out of all the incoming
messages.
    +	 */
    +	public static final class CCUpdater extends VertexUpdateFunction<Long, Long, Long>
{
    +
    +		@Override
    --- End diff --
    
    This essentially does the same as `CCUpdater` in the Spargel example, but since you want
to use this to show that the `VertexUpdateFunction` and the `MessagingFunction` remain the
same, maybe it's better not to change the code here? i.e. have the exact same code as in the
Spargel example.


> Add Min Vertex ID Propagation Library Method and Example
> --------------------------------------------------------
>
>                 Key: FLINK-1883
>                 URL: https://issues.apache.org/jira/browse/FLINK-1883
>             Project: Flink
>          Issue Type: Task
>          Components: Gelly
>    Affects Versions: 0.9
>            Reporter: Andra Lungu
>            Assignee: Andra Lungu
>            Priority: Trivial
>
> Port the example here:http://ci.apache.org/projects/flink/flink-docs-release-0.6/spargel_guide.html#example:-propagate-minimum-vertex-id-in-graph
to Gelly
> FLINK-1871 uses this



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

Mime
View raw message