|
5 | 5 |
|
6 | 6 | package com.vesoft.nebula.algorithm.config
|
7 | 7 |
|
| 8 | +import com.vesoft.nebula.algorithm.config.JaccardConfig.encodeId |
8 | 9 | import org.apache.spark.graphx.VertexId
|
9 | 10 |
|
10 | 11 | case class PRConfig(maxIter: Int, resetProb: Double, encodeId: Boolean = false)
|
@@ -110,24 +111,30 @@ object LouvainConfig {
|
110 | 111 | /**
|
111 | 112 | * degree static
|
112 | 113 | */
|
113 |
| -case class DegreeStaticConfig(degree: Boolean, |
114 |
| - inDegree: Boolean, |
115 |
| - outDegree: Boolean, |
116 |
| - encodeId: Boolean = false) |
| 114 | +case class DegreeStaticConfig(encodeId: Boolean = false) |
117 | 115 |
|
118 | 116 | object DegreeStaticConfig {
|
119 |
| - var degree: Boolean = false |
120 |
| - var inDegree: Boolean = false |
121 |
| - var outDegree: Boolean = false |
122 |
| - var encodeId: Boolean = false |
| 117 | + var encodeId: Boolean = false |
123 | 118 |
|
124 | 119 | def getDegreeStaticConfig(configs: Configs): DegreeStaticConfig = {
|
125 | 120 | val degreeConfig = configs.algorithmConfig.map
|
126 |
| - degree = ConfigUtil.getOrElseBoolean(degreeConfig, "algorithm.degreestatic.degree", false) |
127 |
| - inDegree = ConfigUtil.getOrElseBoolean(degreeConfig, "algorithm.degreestatic.indegree", false) |
128 |
| - outDegree = ConfigUtil.getOrElseBoolean(degreeConfig, "algorithm.degreestatic.outdegree", false) |
129 | 121 | encodeId = ConfigUtil.getOrElseBoolean(degreeConfig, "algorithm.degreestatic.encodeId", false)
|
130 |
| - DegreeStaticConfig(degree, inDegree, outDegree, encodeId) |
| 122 | + DegreeStaticConfig(encodeId) |
| 123 | + } |
| 124 | +} |
| 125 | + |
| 126 | +/** |
| 127 | + * graph triangle count |
| 128 | + */ |
| 129 | +case class TriangleConfig(encodeId: Boolean = false) |
| 130 | + |
| 131 | +object TriangleConfig { |
| 132 | + var encodeId: Boolean = false |
| 133 | + def getTriangleConfig(configs: Configs): TriangleConfig = { |
| 134 | + val triangleConfig = configs.algorithmConfig.map |
| 135 | + encodeId = |
| 136 | + ConfigUtil.getOrElseBoolean(triangleConfig, "algorithm.trianglecount.encodeId", false) |
| 137 | + TriangleConfig(encodeId) |
131 | 138 | }
|
132 | 139 | }
|
133 | 140 |
|
@@ -321,14 +328,16 @@ object Node2vecConfig {
|
321 | 328 | /**
|
322 | 329 | * Jaccard
|
323 | 330 | */
|
324 |
| -case class JaccardConfig(tol: Double) |
| 331 | +case class JaccardConfig(tol: Double, encodeId: Boolean = false) |
325 | 332 |
|
326 | 333 | object JaccardConfig {
|
327 |
| - var tol: Double = _ |
| 334 | + var tol: Double = _ |
| 335 | + var encodeId: Boolean = false |
328 | 336 | def getJaccardConfig(configs: Configs): JaccardConfig = {
|
329 | 337 | val jaccardConfig = configs.algorithmConfig.map
|
330 | 338 | tol = jaccardConfig("algorithm.jaccard.tol").toDouble
|
331 |
| - JaccardConfig(tol) |
| 339 | + encodeId = ConfigUtil.getOrElseBoolean(jaccardConfig, "algorithm.jaccard.encodeId", false) |
| 340 | + JaccardConfig(tol, encodeId) |
332 | 341 | }
|
333 | 342 | }
|
334 | 343 |
|
|
0 commit comments