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

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

Github user tillrohrmann commented on the pull request:

    https://github.com/apache/flink/pull/801#issuecomment-110653949
  
    If I'm not mistaken then something like 
    ```
    int log2(long value){
      if(value & 0xffffffff00000000 > 0) {
        64 - Integer.numberOfLeadingZeros((int)(value >> 32))
      } else {
        32 - Integer.numberOfLeadingZeros((int)value)
      }
    }
    ```
    should do the trick.
    
    For the generalization I think something like `dataSet.zipWithID()` with
    ```
    class DataSet<T> {
      public DataSet<Tuple2<Long, T>> zipWithID() {}
    }
    ```
    would be nice. But we should discuss it on the mailing list whether we want 
this to be part of the API or not. For the beginning, it could be added to some 
kind of utils class.


> 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