-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:atrostan/akka-gps into preproc/hybr…
…id-partitioning
- Loading branch information
Showing
19 changed files
with
586 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.2") | ||
// addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.2") | ||
|
||
libraryDependencies += "com.thesamet.scalapb" %% "compilerplugin" % "0.11.3" | ||
// libraryDependencies += "com.thesamet.scalapb" %% "compilerplugin" % "0.11.3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.algorithm | ||
|
||
import scalax.collection.edge.Implicits._ | ||
import scalax.collection.Graph // or scalax.collection.mutable.Graph | ||
import scalax.collection.GraphPredef._, scalax.collection.GraphEdge._ | ||
import scalax.collection.edge.WDiEdge | ||
|
||
object WCC extends VertexProgram[Int, Int, Int, Int, Int] { | ||
|
||
override val mode: VertexProgram.Mode = VertexProgram.Bidirectional | ||
|
||
override def gather(edgeVal: Int, message: Int): Int = { | ||
message | ||
} | ||
|
||
override def sum(a: Int, b: Int): Int = { | ||
Math.min(a, b) | ||
} | ||
|
||
override def apply(superStepNumber: Int, thisVertexId: Int, oldVal: Int, total: Option[Int]): Int = { | ||
if(superStepNumber == 0) { | ||
thisVertexId | ||
} else total match { | ||
case Some(componentId) => Math.min(oldVal, componentId) | ||
case None => oldVal | ||
} | ||
} | ||
|
||
override def scatter(thisVertexId: Int, oldVal: Int, newVal: Int): Option[Int] = { | ||
if(newVal < oldVal) { | ||
Some(newVal) | ||
} else { | ||
assert(newVal == oldVal, s"Unexpected newVal=${newVal}, oldVal=${oldVal}") | ||
None | ||
} | ||
} | ||
|
||
override def voteToHalt(oldVal: Int, newVal: Int): Boolean = true | ||
|
||
override val defaultVertexValue: Int = Integer.MAX_VALUE | ||
|
||
override val defaultActivationStatus: Boolean = true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.