Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
185 commits
Select commit Hold shift + click to select a range
63a45e6
Add first draft for potential MutableUnionFind interface
May 25, 2026
137ad6e
Rename MutableUnionFind interface to simply UnionFind
Jun 7, 2026
a6820bf
Update methods specified in interface UnionFind
Jun 7, 2026
42aa243
Merge branch 'main' into 49-add-union-find-data-structure
Jun 7, 2026
cb5d31d
Add class MutableUnionFind including empty method bodies and construc…
Jun 7, 2026
27a7728
Implement getAllSubsets in MutableUnionFind
Jun 7, 2026
7d0afc7
Implement addElementToNewSet in MutableUnionFind and capture current …
Jun 7, 2026
33e3326
Rename MutableUnionFind to UnsortedUnionFind and alter uses of HashSe…
Jun 7, 2026
b301753
Implement find as HashMap version in UnsortedUnionFind; contains type…
Jun 8, 2026
4c52fc0
Declare type for whole classes and add rough implementation of union …
Jun 8, 2026
5baa93d
Continue implementing several methods in UnsortedUnionFind and add ne…
Jun 9, 2026
24e376b
Add addNewSet(Set<T> input) to UnsortedUnionFind; might end up replac…
Jun 9, 2026
00d285d
Add notes for further work to UnsortedUnionFind
Jun 9, 2026
6e04f27
Add new class SortedUnionFind; still missing all method bodies
Jun 9, 2026
a7959db
Change all uses of put() to putIfAbsent() in UnsortedUnionFind to ens…
Jun 9, 2026
831ec68
Remove superfluous methods from interface UnionFind
Jun 11, 2026
cb0ca0e
Implement large portion of methods in SortedUnionFind
Jun 11, 2026
b2902e2
Rename SortedUnionFind to SortedTreeSetUnionFind
Jun 11, 2026
fdcd004
Add new interface SortedUnionFind
Jun 11, 2026
eaadc94
Add contains() to UnionFind
Jun 11, 2026
b12540f
Change SortedTreeSetUnionFind to implement SortedUnionFind instead of…
Jun 11, 2026
d9b5dc3
Adapt UnsortedUnionFind to interface alterations
Jun 11, 2026
41ae904
Delete UnsortedUnionFind as currently not planning on using it
Jun 11, 2026
188b203
Implement find() in SortedTreeSetUnionFind and refactor mergeExisting…
Jun 11, 2026
88f484d
Revert back to direct constructor call instead of getEmptyInstanceOf(…
Jun 12, 2026
b432119
Make SortedTreeSetUnionFind's constructor public
Jun 12, 2026
94f1d26
Fix compilation errors due to forbidden types etc. in SortedTreeSetUn…
Jun 17, 2026
97b7bd3
Add SortedUnionFindTest with setup and first few tests; needs further…
Jun 17, 2026
2bafeee
Add test to assure union keeps correct canonical element after union …
Jun 17, 2026
3e1f07a
Make test name more specific in SortedUnionFindTest
Jun 17, 2026
9504ebb
Add test that covers mergeExistingSets() in SortedUnionFindTest
Jun 17, 2026
15e7096
A couple small style fixes
Jun 17, 2026
f4c5213
Change variable declarations from classes to interfaces where needed …
Jun 18, 2026
0ee0893
Change variable declarations from classes to interfaces where needed …
Jun 18, 2026
71b0f16
Add missing edge case in union() in SortedTreeSetUnionFind
Jun 18, 2026
d07c875
Fix bug in addToExistingSet() in SortedTreeSetUnionFind
Jun 19, 2026
0a8f5ec
Add testUnion_InsertingDuplicateElementFails() in SortedUnionFindTest
Jun 19, 2026
469685f
Remove testUnion_InsertingDuplicateElementFails() in SortedUnionFindT…
Jun 19, 2026
3e42ae7
Add testUnion_ConstantCanonicalElementDuringNonlinearInsertion() in S…
Jun 19, 2026
f765a9c
Switch usage of Set to Map to facilitate tracking each subset's canon…
Jun 19, 2026
6221788
Implement changes to interface (exchange Set for Map) in SortedTreeSe…
Jun 19, 2026
7a17558
Remove resolved TODO notes in SortedTreeSetUnionFind
Jun 19, 2026
a3ce540
Add documentation to UnionFind
Jun 23, 2026
493a220
Add documentation to SortedUnionFind
Jun 23, 2026
7370d47
Add documentation to SortedTreeSetUnionFind
Jun 23, 2026
61437f3
Declare type T to be of Comparable in SortedUnionFind and SortedTreeS…
Jun 23, 2026
352907c
Add AbstractImmutableUnionFind
Jun 23, 2026
92088a1
Add AbstractImmutableSortedUnionFind
Jun 23, 2026
d2234c8
Add fix to stop SortedTreeSetUnionFind from failing "test nulls"; not…
Jun 23, 2026
fca3102
Remove find() from deprecated methods; shouldn't have ended up there …
Jun 25, 2026
4dd0356
Add interface PersistentSortedUnionFind
Jun 25, 2026
f7ebd96
Add interface PersistentUnionFind
Jun 25, 2026
89e3a79
Add documentation to PersistentUnionFind and PersistentSortedUnionFind
Jun 25, 2026
f452274
Check input values are not null in SortedTreeSetUnionFind
Jun 26, 2026
a0dacef
Refactor union() to not through unnecessary exceptions in SortedTreeS…
Jun 26, 2026
56133be
Refactor union() to not through unnecessary exceptions in SortedTreeS…
Jun 26, 2026
2f01c62
Merge branch 'main' into 49-add-union-find-data-structure
Jul 3, 2026
efc2bcb
Add beginnings of additional tests in SortedUnionFindTest; not done y…
Jul 5, 2026
9f939ba
Remove previously commited nested classes from SortedUnionFindTest as…
Jul 7, 2026
2f4969d
Add testUnion_Strings() to SortedUnionFindTest
Jul 7, 2026
0782511
Correct test syntax and add more variety to test cases in testUnion_S…
Jul 7, 2026
37770d5
Correct test syntax in SortedUnionFindTest
Jul 7, 2026
9334994
Make result comparison more straightforward in SortedUnionFindTest
Jul 9, 2026
ea44c05
Attempt to fix (but not yet succeed) subset removal bug in SortedTree…
Jul 9, 2026
ee6fb37
Mark new bug discovery in SortedUnionFindTest
Jul 9, 2026
9c86ef7
Fix bug in SortedUnionFindTest (was comparing Integer to String)
Jul 10, 2026
9b27c60
Fix union bug in SortedTreeSetUnionFind
Jul 10, 2026
5917c15
Add separate test class for benchmarking UnionFind called UnionFindSi…
Jul 10, 2026
d67006e
Reduce method calls in UnionFindSimpleBenchmarkTest
Jul 10, 2026
69f5fa6
Fix UnionFindSimpleBenchmarkTest that it finishes within a reasonable…
Jul 10, 2026
1898af1
Replace recursion with iterative approach in UnionFindSimpleBenchmark…
Jul 10, 2026
52571a8
Correct calculations in UnionFindSimpleBenchmarkTest
Jul 14, 2026
5d6cca6
Increase magnitudes slightly in UnionFindSimpleBenchmarkTest
Jul 14, 2026
2dab552
Move all UnionFind classes to new subpackage union_find
Jul 16, 2026
43b4aaa
Rename variable as previous name was misleading
Jul 16, 2026
61278c7
Ignore benchmark test as it is not intended as part of the regular Un…
Jul 16, 2026
919356e
Add AbstractGenericUnionFind as basis for further union-find implemen…
Jul 16, 2026
6bee232
Ignore whole benchmark test class instead of just test method
Jul 16, 2026
9f69580
Move AbstractGenericUnionFind to union_find package
Jul 16, 2026
af996d2
Fic bug causing build to fail (incorrect warning suppression)
Jul 16, 2026
344cd5f
Add package-info.java to union_find package
Jul 16, 2026
761acec
Make SortedTreeSetUnionFind extend AbstractGenericUnionFind
Jul 16, 2026
e9e53d7
Correct package info
Jul 17, 2026
eb1c8b8
Rework how AbstractGenericUnionFind gets correct types from subclasses
Jul 17, 2026
599310b
Remove superfluous super() call in SortedTreeSetUnionFind constructor
Jul 17, 2026
4de8043
format-source
Jul 21, 2026
220ec5c
Refactor AbstractGenericUnionFind to remove unnecessary code
Jul 22, 2026
1834c73
Use sorted data structure for mapOfSets (previously only for subsets)…
Jul 23, 2026
3a54e64
Refactor AbstractGenericUnionFind to simplify awkward code
Jul 23, 2026
a180bcc
Refactor AbstractGenericUnionFind to simplify awkward code
Jul 23, 2026
b9efedc
UnionFindSimpleBenchmarkTest: make test parameterized and add 2 TODOs…
baierd Jul 23, 2026
056f4e1
Add class TreeNode for parent-pointer tree
Jul 23, 2026
a93864c
Add static creation methods in TreeNode; make parent null in root nod…
Jul 23, 2026
47a8e3f
Add simple ParentPointerTree class that uses TreeNode
Jul 23, 2026
ebb1322
Code format and tiny fixes
Jul 23, 2026
9b9be09
Add skeleton of ParentPointerTreeUnionFind
Jul 23, 2026
87a1fb1
Implement most methods of ParentPointerTreeUnionFind and add required…
Jul 24, 2026
2a7248f
Implement missing methods in ParentPointerTreeUnionFind and add requi…
Jul 24, 2026
5dfd680
Avoid null value in TreeNode and bug fix
Jul 24, 2026
aedbd22
Make TreeNode a final class
Jul 24, 2026
54b57a8
Add mapping of each value to its node in ParentPointerTree and adapt …
Jul 24, 2026
e3d08a9
Fix build
Jul 24, 2026
a1cd3b9
Start on improving partition generation in benchmark test
Jul 24, 2026
d816adb
Implement partition generation in a more scalable way in UnionFindSim…
Jul 28, 2026
53c3737
Make refaster happy
Jul 28, 2026
d72cd52
Move union-find tests to subpackage
Aug 12, 2026
3b1644a
Write union-find tests for ParentPointerTreeUnionFind
Aug 12, 2026
4341fb0
Fix bugs in ParentPointerTreeUnionFind uncovered by tests
Aug 12, 2026
166ca86
Add ParentPointerTreeSortedUnionFind
Aug 13, 2026
4f9b6ab
Add test class testing only sortedness for ParentPointerTreeSortedUni…
Aug 13, 2026
b9c6473
Rename ParentPointerTreeSortedUnionFind to SortedParentPointerTreeUni…
Aug 13, 2026
c9d7379
Fix code format
Aug 13, 2026
fe3ad12
Fix bug in ParentPointerTree causing tree to not be binary
Aug 13, 2026
f0320e4
Add documentation to ParentPointerTreeUnionFind
Aug 13, 2026
8a8f25c
Add documentation to SortedParentPointerTreeUnionFind
Aug 13, 2026
452c919
Remove manual size tracking in ParentPointerTree as ArrayList already…
Aug 14, 2026
face617
Introduce AbstractTreeNode class
Aug 14, 2026
8f9a3cb
Rename TreeNode to NonRootNode which now extends AbstractTreeNode and…
Aug 14, 2026
f2ef0f0
Add RootNode which extends AbstractTreeNode and functions accordingly
Aug 14, 2026
9293ac0
Privatise variables in AbstractTreeNode
Aug 14, 2026
3fdb15d
Add method for increasing rank in RootNode
Aug 14, 2026
82c9e3c
Adapt ParentPointerTreeUnionFind to use new node types and not need t…
Aug 14, 2026
23793c0
Adapt SortedParentPointerTreeUnionFind to use new node types and not …
Aug 14, 2026
be98782
Fix type parameter in ParentPointerTreeUnionFindSortednessTest
Aug 14, 2026
4aebe06
Delete ParentPointerTree.java
Aug 14, 2026
c9da608
Update existing documentation
Aug 14, 2026
352a2b6
Code format fixes
Aug 14, 2026
f3f3764
Add documentation to new classes
Aug 14, 2026
842e5c0
Code format fix
Aug 14, 2026
cba998f
Add union by rank to ParentPointerTreeUnionFind and option to select …
Aug 14, 2026
84f91e9
Update documentation to include union by rank
Aug 14, 2026
06c1648
Update tests to cover both union by size and union by rank
Aug 14, 2026
27e702e
Add path compression to ParentPointerTreeUnionFind
Aug 15, 2026
a58eaee
Add implementation of ImmutableParentPointerTreeUnionFind
Aug 15, 2026
1f6f4cc
Increase compatibility between sorted and unsorted union-find versions
Aug 15, 2026
4206ed7
Add SortedUnionFind interface to SortedParentPointerTreeUnionFind
Aug 15, 2026
0d464c4
Change abstract immutable classes to interfaces due to compatibility …
Aug 15, 2026
aa3e1f4
Change abstract immutable classes to interfaces due to compatibility …
Aug 15, 2026
57a0fe7
Change abstract immutable classes to interfaces due to compatibility …
Aug 15, 2026
0c9ba04
Add ImmutableSortedParentPointerTreeUnionFind
Aug 15, 2026
fee7bf6
Code format fix
Aug 15, 2026
f97d033
Revert immutable interfaces back to abstract classes due to other com…
Aug 15, 2026
0c0d850
Make maps in ImmutableParentPointerTreeUnionFind and ImmutableSortedP…
Aug 15, 2026
90d3479
Code format fix
Aug 15, 2026
8300628
Logic fix in ParentPointerTreeUnionFind
Aug 16, 2026
afec034
Logic fixes in ParentPointerTreeUnionFind and SortedParentPointerTree…
Aug 16, 2026
307b5b0
Add PersistentSortedParentPointerTreeUnionFind
Aug 16, 2026
f9aa19b
Code format fixes
Aug 16, 2026
3bd8648
Code format fixes
Aug 16, 2026
c403afd
Code format fixes
Aug 16, 2026
c835aca
Refactor method parameter names
Aug 17, 2026
2f50963
Add new documentation and refactor existing documentation
Aug 17, 2026
cc17a11
Code style fixes
Aug 17, 2026
4800d6c
Bug fix
Aug 17, 2026
d640822
Add test class for immutable (unsorted and sorted) parent pointer tre…
Aug 17, 2026
9a45b3e
Add test class for testing sortedness of ImmutableSortedParentPointer…
Aug 17, 2026
7949ab9
Code format fix
Aug 17, 2026
8b62779
Add PersistentParentPointerTreeUnionFind
Aug 17, 2026
4af6da2
Add documentation to PersistentParentPointerTreeUnionFind
Aug 17, 2026
716a90a
Add tests for unsorted and sorted parent pointer tree union-finds (so…
Aug 17, 2026
06a31f3
Code format fixes
Aug 17, 2026
81b99c8
Add sortedness tests for PersistentSortedParentPointerTreeUnionFind
Aug 17, 2026
33fb798
Make PersistentParentPointerTreeUnionFind a final class
Aug 17, 2026
225cc24
Small bug fixes
Aug 17, 2026
fc834a6
Add add() and addAll() for adding either one or more sets at a time t…
Aug 18, 2026
8795910
Add add() and addAll() to builder of ImmutableParentPointerTreeUnionFind
Aug 18, 2026
a3f499a
Add add() and addAll() to builder of ImmutableSortedParentPointerTree…
Aug 18, 2026
85fdfbb
Add AbstractImmutableParentPointerTreeBuilder to avoid code duplication
Aug 18, 2026
4ee5fcf
Add immutable annotations where necessary
Aug 19, 2026
36d5aaa
Add immutable tree nodes
Aug 19, 2026
aa10c26
Revert "Add immutable tree nodes"
Aug 20, 2026
21deda2
Suppress immutability warnings where mutable data structures used str…
Aug 20, 2026
3ec0c88
Add private method findNode to ParentPointerTreeUnionFind to simplify…
Aug 20, 2026
cd7c1cd
Add benchmarking package and a first benchmarking test
Sep 2, 2026
6ce45fb
Add benchmarking test to run on algs4 input
Sep 4, 2026
d888c6b
Add jars for benchmark tests
Sep 4, 2026
2fb0dfa
Fix bug in Algs4 test
Sep 7, 2026
9933544
Changes from creating jar
Sep 7, 2026
d3455a8
Changes from creating jar
Sep 7, 2026
07e9a8b
Modify jar creation to produce clear names and separate manifests
Sep 7, 2026
687fa8e
Add further benchmark test
Sep 7, 2026
988ee79
Add further benchmark test
Sep 7, 2026
a01f37a
Typo fix
Sep 7, 2026
12c03eb
Prevent modifications to immutable Union-Finds after build() has been…
Sep 7, 2026
1803638
Extend benchmarks to include naive Union-Find implementation
Sep 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .idea/artifacts/algs4benchmark_jar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions .idea/artifacts/find_new_to_old_benchmark_jar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions .idea/artifacts/find_old_to_new_benchmark_jar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions .idea/artifacts/union_single_elements_benchmark_jar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions manifests/algs4benchmark/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Manifest-Version: 1.0
Main-Class: org.sosy_lab.common.collect.union_find.benchmarking.Algs4Dat
asetBenchmark

4 changes: 4 additions & 0 deletions manifests/find_new_to_old_benchmark_jar/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Manifest-Version: 1.0
Main-Class: org.sosy_lab.common.collect.union_find.benchmarking.FindNewT
oOldSingleSetBenchmark

4 changes: 4 additions & 0 deletions manifests/find_old_to_new_benchmark/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Manifest-Version: 1.0
Main-Class: org.sosy_lab.common.collect.union_find.benchmarking.FindOldT
oNewSingleSetBenchmark

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Manifest-Version: 1.0
Main-Class: org.sosy_lab.common.collect.union_find.benchmarking.UnionSin
gleElementsIntoExistingSetBenchmark

18 changes: 18 additions & 0 deletions src/org/sosy_lab/common/collect/PackageSanityTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
package org.sosy_lab.common.collect;

import com.google.common.testing.AbstractPackageSanityTests;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import org.sosy_lab.common.Classes;
import org.sosy_lab.common.collect.union_find.SortedTreeSetUnionFind;

public class PackageSanityTest extends AbstractPackageSanityTests {

Expand All @@ -24,4 +27,19 @@ public class PackageSanityTest extends AbstractPackageSanityTests {
OurSortedMap.class, OurSortedMap.EmptyImmutableOurSortedMap.of(), singletonMap);
ignoreClasses(Classes.IS_GENERATED);
}

{
setDefault(SortedTreeSetUnionFind.class, new SortedTreeSetUnionFind<>());
// ignoreClasses(Classes.IS_GENERATED);

try {
setDefault(Constructor.class, PackageSanityTest.class.getConstructor());
setDefault(Method.class, PackageSanityTest.class.getDeclaredMethod("defaultMethod"));
} catch (NoSuchMethodException e) {
throw new AssertionError(e);
}
}

@SuppressWarnings("unused")
private static void defaultMethod() {}
}
Loading