我是scala和spark-graphx的新手。我写这个方法来更新顶点的不同邻居的分数。
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)
})
编译后出现以下错误:
> 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
有什么想法吗? 非常感谢