Skip to content

Commit 36a3522

Browse files
committed
Ktlint fixes
1 parent 0f31430 commit 36a3522

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

graphs/src/main/kotlin/com/lillicoder/algorithms/graphs/Graph.kt

+13-5
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@ package com.lillicoder.algorithms.graphs
44
* Interface for implementations of a [Graph](https://en.wikipedia.org/wiki/Graph_(abstract_data_type)).
55
*/
66
interface Graph<T> : Iterable<T> {
7-
87
/**
98
* Implementation of an [Iterator] for a [Graph] that uses [Traversal.BREADTH_FIRST] order.
109
* @param graph Graph to traverse.
1110
*/
1211
private class BreadthFirstIterator<T>(
1312
private val graph: Graph<T>,
1413
root: T = graph.root(),
15-
): Iterator<T> {
14+
) : Iterator<T> {
1615
private val queue = ArrayDeque(listOf(root))
1716
private val visited = mutableMapOf(root to true)
1817

@@ -65,7 +64,10 @@ interface Graph<T> : Iterable<T> {
6564
* @param first First element.
6665
* @param second Second element.
6766
*/
68-
fun addEdge(first: T, second: T)
67+
fun addEdge(
68+
first: T,
69+
second: T,
70+
)
6971

7072
/**
7173
* Adds the given element to this graph.
@@ -79,7 +81,10 @@ interface Graph<T> : Iterable<T> {
7981
* @param second Second element.
8082
* @return True if there is an edge between the elements, false otherwise.
8183
*/
82-
fun adjacent(first: T, second: T): Boolean
84+
fun adjacent(
85+
first: T,
86+
second: T,
87+
): Boolean
8388

8489
/**
8590
* Determines if this graph contains the given element.
@@ -115,7 +120,10 @@ interface Graph<T> : Iterable<T> {
115120
* @param first First element.
116121
* @param second Second element.
117122
*/
118-
fun removeEdge(first: T, second: T)
123+
fun removeEdge(
124+
first: T,
125+
second: T,
126+
)
119127

120128
/**
121129
* Removes the given element from this graph.

graphs/src/main/kotlin/com/lillicoder/algorithms/graphs/Traversal.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ package com.lillicoder.algorithms.graphs
55
*/
66
enum class Traversal {
77
BREADTH_FIRST,
8-
DEPTH_FIRST
8+
DEPTH_FIRST,
99
}

trees/src/main/kotlin/com/lillicoder/algorithms/trees/BinaryNode.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ data class BinaryNode<T>(
1010
val left: BinaryNode<T>? = null,
1111
val right: BinaryNode<T>? = null,
1212
override val children: List<Node<T>> = listOfNotNull(left, right),
13-
override val count: Int = 0
13+
override val count: Int = 0,
1414
) : Node<T>

0 commit comments

Comments
 (0)