0

I am new in scala and spark-graphx. I write this method to update the scores of the different neighbors of a vertex.

 def updateNeighborScores(triplet: EdgeTriplet[(VertexId,(Int,Float,Float,Float,String)),Float]):Float={
        graph.mapVertices((id,attr)=> {
          if(id==triplet.dstId)
            {
               val newScore=triplet.attr + triplet.srcAttr._2
              (attr._1,newScore,attr._3,attr._2,"InList")
            }
          else
            (attr._1,attr._2,attr._3,attr._4,attr._5)
        })

I get the following error after compilation:

> Error:(25, 39) overloaded method value + with alternatives:   (x:
> Double)Double <and>   (x: Float)Float <and>   (x: Long)Float <and>  
> (x: Int)Float <and>   (x: Char)Float <and>   (x: Short)Float <and>  
> (x: Byte)Float <and>   (x: String)String  cannot be applied to ((Int,
> Float, Float, Float, String))
>            val newScore=triplet.attr + triplet.srcAttr._2

Any ideas? Many thanks

imen
  • 35
  • 8
  • How do you want to calculate a new score? – michaJlS Oct 27 '16 at 15:35
  • Thank you for your answer....new score=source vertex value+edge value – imen Oct 27 '16 at 15:41
  • It's really hard to help you without knowing the exact types you are dealing with. The best I can do, given the error message, is state that you trying to add something to a tuple `(Int, Float, Float, Float, String)`, there are not operations in the std lib for that. – pedrofurla Oct 27 '16 at 15:42
  • newScore=triplet.srcAttr._2+triplet.attr : The first parameter is the source vertex attribute (float) and the second parameter is the edge attribute (float) – imen Oct 27 '16 at 15:47

0 Answers0