Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Scala中将图形作为参数传递给方法_Scala_Apache Spark_Spark Graphx - Fatal编程技术网

如何在Scala中将图形作为参数传递给方法

如何在Scala中将图形作为参数传递给方法,scala,apache-spark,spark-graphx,Scala,Apache Spark,Spark Graphx,我是Scala新手,我想创建一个用于管理图形任务的类。 所以我想把一个Graph对象作为参数传递给我的类。 例如: val graph = Graph(users, edges, nowhere) users: RDD[(Long, String)], edges: RDD[Edge(Long, Long, String)] nowhere: String 这是我的课 import org.apache.spark._ import org.apache.spark.rdd.RDD impor

我是Scala新手,我想创建一个用于管理图形任务的类。 所以我想把一个Graph对象作为参数传递给我的类。 例如:

val graph = Graph(users, edges, nowhere)
users: RDD[(Long, String)],
edges: RDD[Edge(Long, Long, String)]
nowhere: String
这是我的课

import org.apache.spark._
import org.apache.spark.rdd.RDD
import org.apache.spark.util.IntParam
// import classes required for using GraphX
import org.apache.spark.graphx._

class GraphAnalyzer(_graph: ???? ) {
  val graph:???? =_graph

  def GetVertecies(str: String): Long = {
    val nodesCount: Long =graph.vertices.count()
    nodesCount
  }
}
我不知道我应该在课堂上做什么。 有人能帮我做这件事吗?

我找到了解决办法

它很简单,IDE可以帮助我们。Eclipse向我显示了一个工具提示。基于图的结构,它实际上依赖于图的顶点和边

我使用了以下类型,它可以工作:

import org.apache.spark._
import org.apache.spark.rdd.RDD
import org.apache.spark.util.IntParam
// import classes required for using GraphX
import org.apache.spark.graphx._

class GraphAnalyzer(_graph: Graph[String, Int]  ) {
  val graph:Graph[String, Int]  =_graph

  def GetVertecies(): Long = {
    val nodesCount: Long = graph.vertices.count().toLong
    nodesCount*100
  }
}

org.apache.spark.graphx.Graph
不起作用?或者只是
Graph
,因为您已经导入了org.apache.spark.graphx.?