Skip to content

Commit 0d319b1

Browse files
fix: Remove trailing whitespace from CentroidDecompositionTest
1 parent 7ffe57d commit 0d319b1

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/test/java/com/thealgorithms/datastructures/trees/CentroidDecompositionTest.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ void testStarTree() {
8585
// Star tree: center node 0 connected to 1, 2, 3, 4
8686
int[][] edges = {{0, 1}, {0, 2}, {0, 3}, {0, 4}};
8787
CentroidDecomposition.CentroidTree tree = CentroidDecomposition.buildFromEdges(5, edges);
88-
88+
8989
assertEquals(5, tree.size());
9090
// Center node (0) should be the root
9191
assertEquals(0, tree.getRoot());
92-
92+
9393
// All other nodes should have 0 as parent
9494
for (int i = 1; i < 5; i++) {
9595
assertEquals(0, tree.getParent(i));
@@ -106,10 +106,10 @@ void testCompleteTree() {
106106
// 3 4 5 6
107107
int[][] edges = {{0, 1}, {0, 2}, {1, 3}, {1, 4}, {2, 5}, {2, 6}};
108108
CentroidDecomposition.CentroidTree tree = CentroidDecomposition.buildFromEdges(7, edges);
109-
109+
110110
assertEquals(7, tree.size());
111111
assertEquals(0, tree.getRoot()); // Root should be the center
112-
112+
113113
// Verify all nodes are reachable in centroid tree
114114
boolean[] visited = new boolean[7];
115115
visited[0] = true;
@@ -125,16 +125,16 @@ void testCompleteTree() {
125125
void testLargerTree() {
126126
// Tree with 10 nodes
127127
int[][] edges = {
128-
{0, 1}, {0, 2}, {1, 3}, {1, 4},
128+
{0, 1}, {0, 2}, {1, 3}, {1, 4},
129129
{2, 5}, {2, 6}, {3, 7}, {4, 8}, {5, 9}
130130
};
131131
CentroidDecomposition.CentroidTree tree = CentroidDecomposition.buildFromEdges(10, edges);
132-
132+
133133
assertEquals(10, tree.size());
134134
int root = tree.getRoot();
135135
assertTrue(root >= 0 && root < 10);
136136
assertEquals(-1, tree.getParent(root));
137-
137+
138138
// Verify centroid tree structure is valid
139139
for (int i = 0; i < 10; i++) {
140140
if (i != root) {
@@ -148,7 +148,7 @@ void testPathGraph() {
148148
// Path graph with 8 nodes: 0-1-2-3-4-5-6-7
149149
int[][] edges = {{0, 1}, {1, 2}, {2, 3}, {3, 4}, {4, 5}, {5, 6}, {6, 7}};
150150
CentroidDecomposition.CentroidTree tree = CentroidDecomposition.buildFromEdges(8, edges);
151-
151+
152152
assertEquals(8, tree.size());
153153
// For path of 8 nodes, centroid should be around middle
154154
int root = tree.getRoot();
@@ -205,11 +205,11 @@ void testInvalidNodeInEdge() {
205205
void testInvalidNodeQuery() {
206206
int[][] edges = {{0, 1}, {1, 2}};
207207
CentroidDecomposition.CentroidTree tree = CentroidDecomposition.buildFromEdges(3, edges);
208-
208+
209209
assertThrows(IllegalArgumentException.class, () -> {
210210
tree.getParent(-1);
211211
});
212-
212+
213213
assertThrows(IllegalArgumentException.class, () -> {
214214
tree.getParent(5);
215215
});
@@ -219,7 +219,7 @@ void testInvalidNodeQuery() {
219219
void testToString() {
220220
int[][] edges = {{0, 1}, {1, 2}};
221221
CentroidDecomposition.CentroidTree tree = CentroidDecomposition.buildFromEdges(3, edges);
222-
222+
223223
String result = tree.toString();
224224
assertNotNull(result);
225225
assertTrue(result.contains("Centroid Tree"));
@@ -237,7 +237,7 @@ void testAdjacencyListConstructor() {
237237
adj.get(1).add(0);
238238
adj.get(1).add(2);
239239
adj.get(2).add(1);
240-
240+
241241
CentroidDecomposition.CentroidTree tree = new CentroidDecomposition.CentroidTree(adj);
242242
assertEquals(3, tree.size());
243243
assertEquals(1, tree.getRoot());

0 commit comments

Comments
 (0)