Skip to content

Commit 8ee9310

Browse files
authored
fix some variable (#23)
1 parent 3e25367 commit 8ee9310

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

nebula-algorithm/src/main/scala/com/vesoft/nebula/algorithm/config/Configs.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,12 +355,12 @@ object AlgoConstants {
355355
val LPA_RESULT_COL: String = "lpa"
356356
val CC_RESULT_COL: String = "cc"
357357
val SCC_RESULT_COL: String = "scc"
358-
val BETWEENNESS_RESULT_COL: String = "betweennedss"
358+
val BETWEENNESS_RESULT_COL: String = "betweenness"
359359
val SHORTPATH_RESULT_COL: String = "shortestpath"
360360
val DEGREE_RESULT_COL: String = "degree"
361361
val INDEGREE_RESULT_COL: String = "inDegree"
362362
val OUTDEGREE_RESULT_COL: String = "outDegree"
363-
val TRIANGLECOUNT_RESULT_COL: String = "tranglecount"
363+
val TRIANGLECOUNT_RESULT_COL: String = "trianglecount"
364364
val CLUSTERCOEFFICIENT_RESULT_COL: String = "clustercoefficient"
365365
val CLOSENESS_RESULT_COL: String = "closeness"
366366
val HANP_RESULT_COL: String = "hanp"

nebula-algorithm/src/main/scala/com/vesoft/nebula/algorithm/lib/KCoreAlgo.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import org.apache.spark.sql.{DataFrame, Dataset, Row, SparkSession}
1515
object KCoreAlgo {
1616
private val LOGGER = Logger.getLogger(this.getClass)
1717

18-
val ALGORITHM: String = "LabelPropagation"
18+
val ALGORITHM: String = "KCore"
1919

2020
/**
2121
* run the louvain algorithm for nebula graph
@@ -42,7 +42,7 @@ object KCoreAlgo {
4242
var lastVertexNum: Long = graph.numVertices
4343
var currentVertexNum: Long = -1
4444
var isStable: Boolean = false
45-
var iterNum: Int = 1
45+
var iterNum: Int = 0
4646

4747
var degreeGraph = graph
4848
.outerJoinVertices(graph.degrees) { (vid, vd, degree) =>

nebula-algorithm/src/main/scala/com/vesoft/nebula/algorithm/lib/Node2vecAlgo.scala

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
/*
22
* Copyright (c) 2021. vesoft inc. All rights reserved.
33
*
4-
* This source code is licensed under Apache 2.0 License,
5-
* attached with Common Clause Condition 1.0, found in the LICENSES directory.
4+
* This source code is licensed under Apache 2.0 License.
65
*/
76

87
package com.vesoft.nebula.algorithm.lib
@@ -85,6 +84,7 @@ object Node2vecAlgo {
8584

8685
(J, q)
8786
}
87+
8888
def setupEdgeAlias(p: Double = 1.0, q: Double = 1.0)(
8989
srcId: Long,
9090
srcNeighbors: Array[(Long, Double)],
@@ -100,13 +100,15 @@ object Node2vecAlgo {
100100

101101
setupAlias(neighbors_)
102102
}
103+
103104
def drawAlias(J: Array[Int], q: Array[Double]): Int = {
104105
val K = J.length
105106
val kk = math.floor(math.random * K).toInt
106107

107108
if (math.random < q(kk)) kk
108109
else J(kk)
109110
}
111+
110112
def load(graph: Graph[None.type, Double]): this.type = {
111113
val bcMaxDegree = context.broadcast(node2vecConfig.degree)
112114
val bcEdgeCreator = node2vecConfig.directed match {
@@ -145,6 +147,7 @@ object Node2vecAlgo {
145147
.cache
146148
this
147149
}
150+
148151
def initTransitionProb(): this.type = {
149152
val bcP = context.broadcast(node2vecConfig.p)
150153
val bcQ = context.broadcast(node2vecConfig.q)
@@ -172,6 +175,7 @@ object Node2vecAlgo {
172175

173176
this
174177
}
178+
175179
def randomWalk(): this.type = {
176180
val edge2attr = graph.triplets
177181
.map { edgeTriplet =>
@@ -230,9 +234,9 @@ object Node2vecAlgo {
230234
randomWalkPaths = randomWalk
231235
}
232236
}
233-
234237
this
235238
}
239+
236240
def embedding(): this.type = {
237241
val randomPaths = randomWalkPaths
238242
.map {

0 commit comments

Comments
 (0)