Skip to content

Commit 88dff94

Browse files
committed
minor kotlin fix
1 parent df304c3 commit 88dff94

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

src/kotlin/sequential/graph/bfs/BreadthFirstTraversal.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ fun main() {
3636
)
3737

3838
println(
39-
socialNetwork.bfs("you")
39+
socialNetwork.bfs(root = "you")
4040
)
4141
}

src/kotlin/sequential/graph/dfs/IterativeDepthFirstTraversal.kt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,14 @@ fun <T> Graph<T>.dfs(root: T): Collection<T> {
2828

2929

3030
fun main() {
31-
31+
val socialNetwork: Graph<String> = mapOf(
32+
"you" to listOf("tony", "steve", "nick"),
33+
"tony" to listOf("clint"),
34+
"nick" to listOf("thor", "natasha"),
35+
"steve" to listOf("phil", "clint")
36+
)
37+
38+
println(
39+
socialNetwork.dfs(root = "you")
40+
)
3241
}

src/kotlin/sequential/graph/dfs/RecursiveDepthFirstTraversal.kt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,14 @@ fun <T> Graph<T>.dfs(root: T): Collection<T> {
2424

2525

2626
fun main() {
27-
27+
val socialNetwork: Graph<String> = mapOf(
28+
"you" to listOf("tony", "steve", "nick"),
29+
"tony" to listOf("clint"),
30+
"nick" to listOf("thor", "natasha"),
31+
"steve" to listOf("phil", "clint")
32+
)
33+
34+
println(
35+
socialNetwork.dfs(root = "you")
36+
)
2837
}

0 commit comments

Comments
 (0)