You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spark.apache.org by "Ulanov, Alexander" <al...@hpe.com> on 2016/08/02 12:29:10 UTC
Graph edge type pattern matching in GraphX
Dear Spark developers,
Could you suggest how to perform pattern matching on the type of the graph edge in the following scenario. I need to perform some math by means of aggregateMessages on the graph edges if edges are Double. Here is the code:
def my[VD: ClassTag, ED: ClassTag] (graph: Graph[VD, ED]): Double {
graph match {
g: Graph[_, Double] => g.aggregateMessages[Double](t => t.sendToSrc(t.attr), _ + _).values.max
_ => 0.0
}
}
However, it does not work, because aggregateMessages creates context t of type [VD, ED, Double]. I expect it to create context of [VD, Double, Double] because of the type pattern matching. Could you suggest what is the issue?
Best regards, Alexander