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

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

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

    https://github.com/apache/flink/pull/801#discussion_r33820633
  
    --- Diff: docs/apis/zip_elements_guide.md ---
    @@ -63,4 +63,44 @@ env.execute()
     
     will yield the tuples: (0,A), (1,B), (2,C), (3,D), (4,E), (5,F)
     
    +[Back to top](#top)
    +
    +### Zip with an Unique Identifier
    +In many cases, one may not need to assign consecutive labels.
    +`zipWIthUniqueId` works in a pipelined fashion, speeding up the label 
assignment process. This method receives a data set as input and returns a new 
data set of unique id, initial value tuples.
    +For example, the following code:
    +
    +<div class="codetabs" markdown="1">
    +<div data-lang="java" markdown="1">
    +{% highlight java %}
    +ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
    +env.setParallelism(1);
    +DataSet<String> in = env.fromElements("A", "B", "C", "D", "E", "F");
    +
    +DataSet<Tuple2<Long, String>> result = DataSetUtils.zipWithUniqueId(in);
    +
    +result.writeAsCsv(resultPath, "\n", ",");
    +env.execute();
    +{% endhighlight %}
    +</div>
    +
    +<div data-lang="scala" markdown="1">
    +{% highlight scala %}
    +import org.apache.flink.api.scala._
    +
    +val env: ExecutionEnvironment = 
ExecutionEnvironment.getExecutionEnvironment
    +env.setParallelism(1)
    +val input: DataSet[String] = env.fromElements("A", "B", "C", "D", "E", "F")
    +
    +val result: DataSet[(Long, String)] = input.zipWithUniqueId
    +
    +result.writeAsCsv(resultPath, "\n", ",")
    +env.execute()
    +{% endhighlight %}
    +</div>
    +
    +</div>
    +
    +will yield the tuples: (0,A), (2,B), (4,C), (6,D), (8,E), (10,F)
    --- End diff --
    
    is the result deterministic?


> Add a library method that assigns unique Long values to vertices
> ----------------------------------------------------------------
>
>                 Key: FLINK-2150
>                 URL: https://issues.apache.org/jira/browse/FLINK-2150
>             Project: Flink
>          Issue Type: New Feature
>          Components: Gelly
>            Reporter: Vasia Kalavri
>            Assignee: Andra Lungu
>            Priority: Minor
>              Labels: starter
>
> In some graph algorithms, it is required to initialize the vertex values with 
> unique values (e.g. label propagation).
> This issue proposes adding a Gelly library method that receives an input 
> graph and initializes its vertex values with unique Long values.
> This method can then also be used to improve the MusicProfiles example.



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

Reply via email to