Skip to content
This repository has been archived by the owner on Jan 1, 2023. It is now read-only.

Commit

Permalink
Formatting fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
gchallen committed Oct 28, 2021
1 parent 67626a6 commit 9d1078e
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 7 deletions.
21 changes: 21 additions & 0 deletions .idea/runConfigurations/Check.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions .idea/runConfigurations/Format.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions .idea/runConfigurations/Test.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions .idea/runConfigurations/Update_Dependencies.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions src/main/java/cs125/graphs/UndirectedGraph.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ fun <T> Map<InputNode<T>, Set<InputNode<T>>>.toGraph(): Node<T> {
val mapping = keys.mapIndexed { index, key -> key to Node(key.value, index) }.toMap()
forEach { (key, values) ->
check(mapping[key] != null) { "Missing mapping for key in graph creation" }
mapping[key]!!.neighbors.addAll(values.map {
mapping[it] ?: error("Missing mapping for value in graph creation")
})
mapping[key]!!.neighbors.addAll(
values.map {
mapping[it] ?: error("Missing mapping for value in graph creation")
}
)
}

mapping.values.forEach {
Expand Down Expand Up @@ -182,4 +184,4 @@ class UndirectedGraph<T>(inputEdges: Map<InputNode<T>, Set<InputNode<T>>>) {
}
}
}
*/
*/
6 changes: 3 additions & 3 deletions src/test/kotlin/TestUndirectedGraph.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import io.kotest.matchers.shouldBe
class TestUndirectedGraph : StringSpec({
"it should create a single-node graph" {
singleNodeGraph(8).also {
Example.size(it) shouldBe 1
Example.sum(it) shouldBe 8
Example.size(it) shouldBe 1
Example.sum(it) shouldBe 8
}
}
"it should create a two-node graph" {
Expand All @@ -31,4 +31,4 @@ class TestUndirectedGraph : StringSpec({
Example.sum(it) shouldBe (32..63).sum()
}
}
})
})

0 comments on commit 9d1078e

Please sign in to comment.