|
1 | 1 | package com.thealgorithms.graph; |
2 | 2 |
|
3 | | -import static org.junit.jupiter.api.Assertions.*; |
4 | | -import java.util.*; |
| 3 | +import static org.junit.jupiter.api.Assertions.assertEquals; |
| 4 | +import static org.junit.jupiter.api.Assertions.assertFalse; |
| 5 | +import static org.junit.jupiter.api.Assertions.assertTrue; |
| 6 | + |
| 7 | +import java.util.Arrays; |
| 8 | +import java.util.Collections; |
| 9 | +import java.util.HashMap; |
| 10 | +import java.util.LinkedList; |
| 11 | +import java.util.List; |
| 12 | +import java.util.Map; |
5 | 13 | import org.junit.jupiter.api.Test; |
6 | 14 |
|
7 | 15 | public class HierholzerAlgorithmTest { |
8 | 16 |
|
9 | 17 | @Test |
10 | 18 | public void testFindsEulerianCircuitInSimpleTriangleGraph() { |
11 | | - // A simple triangle graph where a circuit definitely exists: 0-1, 1-2, 2-0 |
| 19 | + // Create a simple triangle graph where a circuit definitely exists: 0-1, 1-2, 2-0 |
12 | 20 | Map<Integer, LinkedList<Integer>> graph = new HashMap<>(); |
13 | 21 | graph.put(0, new LinkedList<>(Arrays.asList(1, 2))); |
14 | 22 | graph.put(1, new LinkedList<>(Arrays.asList(0, 2))); |
@@ -42,7 +50,7 @@ public void testFailsForGraphWithOddDegreeVertices() { |
42 | 50 | // The find method should return an empty list |
43 | 51 | assertTrue(algorithm.findEulerianCircuit().isEmpty()); |
44 | 52 | } |
45 | | - |
| 53 | + |
46 | 54 | @Test |
47 | 55 | public void testFailsForDisconnectedGraph() { |
48 | 56 | // Create a graph with two separate triangles (0-1-2 and 3-4-5) |
|
0 commit comments