Giter VIP home page Giter VIP logo

Comments (10)

riomus avatar riomus commented on June 9, 2024

Hi,

Please share whole code. Probably you are not importing operators DSL:

import ml.sparkling.graph.operators.OperatorsDSL._

please refer to http://sparkling-graph.readthedocs.io/en/latest/eigenvector.html

Please close the issue if all is ok.

from sparkling-graph.

alsamei avatar alsamei commented on June 9, 2024

Thank you very much for the quick response.
Actually, I have already checked this link and the problem is there (in the import statement).
Previously, I imported this
import ml.sparkling.graph.operators.OperatorsDSL._
However, it showed me this error "object operators is not a member of package ml.sparkling.graph".

Then I changed it to import ml.sparkling.graph._
I am thinking this import will include the whole classes inside.
Then the error still there "value localClustering is not a member of org.apache.spark.graphx.Graph[Int,Int]".

This is my whole code:

package org.learning.spark

import org.apache.spark.SparkConf
import org.apache.spark.SparkContext
import org.apache.spark.storage.StorageLevel
import org.apache.spark.graphx.GraphLoader
import org.apache.spark.graphx.Graph
import org.apache.spark.rdd.RDD
import org.apache.spark.graphx._
import org.apache.spark.graphx.util.GraphGenerators._
import java.util.Calendar
import ml.sparkling.graph.operators.OperatorsDSL._
import ml.sparkling.graph.api.operators.measures.VertexMeasureConfiguration
import org.apache.spark.sql.SQLContext._
import org.apache.spark.sql._
import org.apache.spark.sql.functions._
import org.apache.spark.sql.SQLContext
import org.apache.log4j.{Level, Logger}

object JustForTrying {
  def main(args: Array[String]) {
    
    Logger.getLogger("org").setLevel(Level.OFF)
    Logger.getLogger("akka").setLevel(Level.OFF)
    val master = args(0)
    val sourceGraph = args(1)
    val compGraph = args(2)
    val run = args(3)
    val numPart = args(4)
    val jobName = args(5)
    val runFull = args(6)
    
    val sparkConf: SparkConf = new SparkConf().setAppName(jobName.toString()).setMaster(master)
   
    val sc:SparkContext=new SparkContext(sparkConf)
    val sqlContext = new org.apache.spark.sql.SQLContext(sc)
    import sqlContext.implicits._

      println("Comparing Two Graphs")
      
      val graph: Graph[Int, Int] = GraphLoader.edgeListFile(sc, sourceGraph, canonicalOrientation = true, numEdgePartitions = numPart.toInt, edgeStorageLevel = StorageLevel.MEMORY_AND_DISK_SER, vertexStorageLevel = StorageLevel.MEMORY_AND_DISK_SER)
        .partitionBy(PartitionStrategy.RandomVertexCut, numPart.toInt).groupEdges((a, b) => a)
      
     
      // Local Clustering Score
    val clusteringGraph: Graph[Double, Int] = graph.localClustering(VertexMeasureConfiguration(treatAsUndirected=true))
    val localCentralityRDD: VertexRDD[Double] = clusteringGraph.vertices
    // Eigen Vector Score
    val eigenvectorRDD: VertexRDD[Double] = graph.eigenvectorCentrality(VertexMeasureConfiguration(treatAsUndirected=true)).vertices
   
  sc.stop()   
  
  }
}

from sparkling-graph.

riomus avatar riomus commented on June 9, 2024

Problem is here:

"object operators is not a member of package ml.sparkling.graph".

Please show your dependencies, probably you do not have correct one
Do you have:
libraryDependencies += "ml.sparkling" %% "sparkling-graph-operators" % "0.0.8-SNAPSHOT"

from sparkling-graph.

alsamei avatar alsamei commented on June 9, 2024

These are my Maven dependencies in the pom.xml File:

junit junit 3.8.1 test
  <dependency>
     <groupId>org.apache.spark</groupId>
     <artifactId>spark-core_2.10</artifactId>
     <version>2.2.0</version>
  </dependency>

  <dependency>
     <groupId>org.apache.spark</groupId>
     <artifactId>spark-sql_2.11</artifactId>
     <version>2.1.0</version>
     <scope>provided</scope>
  </dependency>

  <dependency>
     <groupId>org.apache.spark</groupId>
     <artifactId>spark-graphx_2.10</artifactId>
     <version>2.2.0</version>
  </dependency>
  
  <dependency>
      <groupId>org.apache.spark</groupId>
      <artifactId>spark-sql_2.11</artifactId>
      <version>2.2.0</version>
  </dependency>
  
  <dependency>
       <groupId>org.apache.spark</groupId>
       <artifactId>spark-mllib_2.10</artifactId>
       <version>1.6.0</version>
  </dependency>

<dependency>
    <groupId>ml.sparkling</groupId>
    <artifactId>sparkling-graph-api_2.11</artifactId>
    <version>0.0.7</version>
</dependency>

from sparkling-graph.

alsamei avatar alsamei commented on June 9, 2024

the ml.sparkling is the last dependency

from sparkling-graph.

riomus avatar riomus commented on June 9, 2024

Yes, that is the problem, you have only API, in order to use the lib you must have appropriate packages. Please try adding:

<dependency>
    <groupId>ml.sparkling</groupId>
    <artifactId>sparkling-graph-operators_2.11</artifactId>
    <version>0.0.7</version>
</dependency>

from sparkling-graph.

alsamei avatar alsamei commented on June 9, 2024

Thanks, it works and no error now in the code. However, I got this run time error [in the command Prompt], after executing the spark-submit command. It is regarding the same lines of codes.

Exception in thread "main" java.lang.NoClassDefFoundError: ml/sparkling/graph/operators/OperatorsDSL$

from sparkling-graph.

riomus avatar riomus commented on June 9, 2024

How are you packaging your application? You must assembly app so your jar will contain all needed classes or you need to put dependencies on spark classpath. (all errors that you are posting here are not problems with SparklingGraph). Please google how to do deploy spark app, it is even mentioned in spark docs

If your code depends on other projects, you will need to package them alongside your application in order to distribute the code to a Spark cluster. To do this, create an assembly jar (or β€œuber” jar) containing your code and its dependencies. Both sbt and Maven have assembly plugins.

from sparkling-graph.

riomus avatar riomus commented on June 9, 2024

Hi,

Please close the issue if all is ok now.

To be clear, that was not an issue with SparklingGraph

from sparkling-graph.

riomus avatar riomus commented on June 9, 2024

I am closing the issue for now because of lack of response

from sparkling-graph.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.