How do I manipulate values outside of a GraphX loop?

2014-09-16 Thread crockpotveggies
Brand new to Apache Spark and I'm a little confused how to make updates to a
value that sits outside of a .mapTriplets iteration in GraphX. I'm aware
mapTriplets is really only for modifying values inside the graph. What about
using it in conjunction with other computations? See below:

def mapTripletsMethod(edgeWeights: Graph[Int, Double],
stationaryDistribution: Graph[Double, Double]) = {
  val tempMatrix: SparseDoubleMatrix2D = graphToSparseMatrix(edgeWeights)

  stationaryDistribution.mapTriplets{ e =>
  val row = e.srcId.toInt
  val column = e.dstId.toInt
  var cellValue = -1 * tempMatrix.get(row, column) + e.dstAttr
  tempMatrix.set(row, column, cellValue) // this doesn't do anything to
tempMatrix
  e
}
}

My first guess is that since the input param for mapTriplets is a function,
then somehow the value for tempMatrix is getting lost or duplicated.

If this really isn't the proper design pattern to do this, does anyone have
any insight on the "right way"? Implementing some of the more complex
centrality algorithms is rather difficult until I can wrap my head around
this paradigm.

Thank you!



--
View this message in context: 
http://apache-spark-user-list.1001560.n3.nabble.com/How-do-I-manipulate-values-outside-of-a-GraphX-loop-tp14400.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: user-unsubscr...@spark.apache.org
For additional commands, e-mail: user-h...@spark.apache.org



Convert GraphX Graph to Sparse Matrix

2014-09-15 Thread crockpotveggies
Hi everyone,

I'm looking to implement Markov algorithms in GraphX and I'm wondering if
it's already possible to auto-convert the Graph into a Sparse Double Matrix?
I've seen this implemented in other graphs before, namely JUNG, but still
familiarizing myself with GraphX. Example:
https://code.google.com/p/jung/source/browse/branches/guava/jung/jung-algorithms/src/main/java/edu/uci/ics/jung/algorithms/matrix/GraphMatrixOperations.java#181

This is specifically for doing operations such as Mean First Passage Time
calculations. If it doesn't yet exist, are the Matrices implemented in MLLib
going to be enough for this? Or will I need to go the way of Breeze or Colt?

Thanks!



--
View this message in context: 
http://apache-spark-user-list.1001560.n3.nabble.com/Convert-GraphX-Graph-to-Sparse-Matrix-tp14303.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: user-unsubscr...@spark.apache.org
For additional commands, e-mail: user-h...@spark.apache.org