Skip to content

Commit a37e0db

Browse files
authored
chore: typo fixes and added import for examples (#19)
this may help fresh user to copy/paste and run smoothly
1 parent 0337b2b commit a37e0db

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

README-CN.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,13 @@ nebula-algorithm 是一款基于 [GraphX](https://spark.apache.org/graphx/) 的
5959
```
6060
* 定义算法参数调用算法(以`PageRank`为例)
6161
```
62+
import com.vesoft.nebula.algorithm.config.{Configs, PRConfig, SparkConfig}
63+
import org.apache.spark.sql.{DataFrame, SparkSession}
64+
65+
val spark = SparkSession.builder().master("local").getOrCreate()
66+
val data = spark.read.option("header", true).csv("src/test/resources/edge.csv")
6267
val prConfig = new PRConfig(5, 1.0)
63-
val louvainResult = PageRankAlgo.apply(spark, data, prConfig, false)
68+
val prResult = PageRankAlgo.apply(spark, data, prConfig, false)
6469
```
6570
6671
其他算法的调用方法见[测试示例](https://github.com/vesoft-inc/nebula-algorithm/tree/master/nebula-algorithm/src/test/scala/com/vesoft/nebula/algorithm/lib) 。

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,13 @@ Limitation: Due to Nebula Algorithm will not encode string id, thus during the a
6969
```
7070
* Instantiate algorithm's config, below is an example for `PageRank`.
7171
```
72+
import com.vesoft.nebula.algorithm.config.{Configs, PRConfig, SparkConfig}
73+
import org.apache.spark.sql.{DataFrame, SparkSession}
74+
75+
val spark = SparkSession.builder().master("local").getOrCreate()
76+
val data = spark.read.option("header", true).csv("src/test/resources/edge.csv")
7277
val prConfig = new PRConfig(5, 1.0)
73-
val louvainResult = PageRankAlgo.apply(spark, data, prConfig, false)
78+
val prResult = PageRankAlgo.apply(spark, data, prConfig, false)
7479
```
7580
7681
For other algorithms, please refer to [test cases](https://github.com/vesoft-inc/nebula-algorithm/tree/master/nebula-algorithm/src/test/scala/com/vesoft/nebula/algorithm/lib).

nebula-algorithm/src/test/scala/com/vesoft/nebula/algorithm/lib/PageRankAlgoSuite.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ import org.junit.Test
1212
class PageRankAlgoSuite {
1313
@Test
1414
def pageRankSuite(): Unit = {
15-
val spark = SparkSession.builder().master("local").getOrCreate()
16-
val data = spark.read.option("header", true).csv("src/test/resources/edge.csv")
17-
val prConfig = new PRConfig(5, 1.0)
18-
val louvainResult = PageRankAlgo.apply(spark, data, prConfig, false)
19-
assert(louvainResult.count() == 4)
15+
val spark = SparkSession.builder().master("local").getOrCreate()
16+
val data = spark.read.option("header", true).csv("src/test/resources/edge.csv")
17+
val prConfig = new PRConfig(5, 1.0)
18+
val prResult = PageRankAlgo.apply(spark, data, prConfig, false)
19+
assert(prResult.count() == 4)
2020
}
2121
}

0 commit comments

Comments
 (0)