|
| 1 | +// To run this test in isolation from root folder: |
| 2 | +// |
| 3 | +// $ gradle test --tests |
| 4 | +// javatests.com.williamfiset.algorithms.graphtheory.treealgorithms.TreeIsomorphismWithBfsTest |
| 5 | + |
1 | 6 | package javatests.com.williamfiset.algorithms.graphtheory.treealgorithms;
|
2 | 7 |
|
3 | 8 | import static com.google.common.truth.Truth.assertThat;
|
4 | 9 | import static com.williamfiset.algorithms.graphtheory.treealgorithms.TreeIsomorphismWithBfs.addUndirectedEdge;
|
5 | 10 | import static com.williamfiset.algorithms.graphtheory.treealgorithms.TreeIsomorphismWithBfs.createEmptyTree;
|
6 | 11 | import static com.williamfiset.algorithms.graphtheory.treealgorithms.TreeIsomorphismWithBfs.encodeTree;
|
7 | 12 | import static com.williamfiset.algorithms.graphtheory.treealgorithms.TreeIsomorphismWithBfs.treesAreIsomorphic;
|
| 13 | +import static com.williamfiset.algorithms.graphtheory.treealgorithms.TreeIsomorphism.TreeNode; |
8 | 14 |
|
9 | 15 | import java.util.*;
|
10 | 16 | import org.junit.*;
|
@@ -119,4 +125,59 @@ public void testSlidesExample() {
|
119 | 125 | String expectedEncoding = "(((()())(()())())((())()()())(()()()))";
|
120 | 126 | assertThat(treeEncoding).isEqualTo(expectedEncoding);
|
121 | 127 | }
|
| 128 | + |
| 129 | + @Test |
| 130 | + public void t() { |
| 131 | + List<List<Integer>> tree = createEmptyTree(10); |
| 132 | + |
| 133 | + TreeNode node0 = new TreeNode(0); |
| 134 | + TreeNode node1 = new TreeNode(1); |
| 135 | + TreeNode node2 = new TreeNode(2); |
| 136 | + TreeNode node3 = new TreeNode(3); |
| 137 | + TreeNode node4 = new TreeNode(4); |
| 138 | + TreeNode node5 = new TreeNode(5); |
| 139 | + TreeNode node6 = new TreeNode(6); |
| 140 | + TreeNode node7 = new TreeNode(7); |
| 141 | + TreeNode node8 = new TreeNode(8); |
| 142 | + TreeNode node9 = new TreeNode(9); |
| 143 | + |
| 144 | + node0.addChildren(node1, node2, node3); |
| 145 | + node1.addChildren(node4, node5); |
| 146 | + node5.addChildren(node9); |
| 147 | + node2.addChildren(node6, node7); |
| 148 | + node3.addChildren(node8); |
| 149 | + |
| 150 | + System.out.println(com.williamfiset.algorithms.graphtheory.treealgorithms.TreeIsomorphism.encode(node0)); |
| 151 | + |
| 152 | + // (((())())(()())(())) |
| 153 | + // ((())()) |
| 154 | + // (()()) |
| 155 | + // (()) |
| 156 | + // |
| 157 | + |
| 158 | + // (()()) |
| 159 | + // (()) |
| 160 | + // (()) |
| 161 | + |
| 162 | + // ((()())(())) |
| 163 | + // ((())()) |
| 164 | + // |
| 165 | + // ((()())(()))((())()) |
| 166 | + |
| 167 | + |
| 168 | + // (((()())(()))((())())) |
| 169 | + // (()()) |
| 170 | + // (()) |
| 171 | + // |
| 172 | + // ((())()) |
| 173 | + // |
| 174 | + } |
122 | 175 | }
|
| 176 | + |
| 177 | + |
| 178 | + |
| 179 | + |
| 180 | + |
| 181 | + |
| 182 | + |
| 183 | + |
0 commit comments