### Question:
IncrementalDisjointSetStruct extends SequentialDisjointSetStruct { @Override public long setIdOf(final long nodeId) { long setId = find(nodeId); return setIdOfRoot(setId); } IncrementalDisjointSetStruct(
            long size,
            NodeProperties communityMapping,
            AllocationTracker tracker); static MemoryEstimation memoryEstimation(); @Override HugeLongArray parent(); @Override long size(); @Override long find(final long nodeId); @Override long setIdOf(final long nodeId);  }### Answer:
@Test void shouldRunWithLessInitialCommunities() { NodeProperties communities = new TestNodeProperties(0, 0, 1, 0); SequentialDisjointSetStruct dss = newSet(4, communities); assertEquals(3, getSetCount(dss)); assertEquals(dss.setIdOf(0), dss.setIdOf(1)); assertEquals(dss.setIdOf(0), dss.setIdOf(1)); assertNotEquals(dss.setIdOf(0), dss.setIdOf(2)); assertNotEquals(dss.setIdOf(0), dss.setIdOf(3)); assertNotEquals(dss.setIdOf(2), dss.setIdOf(3)); }
@Test void shouldRunWithLessInitialCommunitiesAndLargerIdSpace() { NodeProperties communities = new TestNodeProperties(0, 10, 1, 10); SequentialDisjointSetStruct dss = newSet(4, communities); assertEquals(3, getSetCount(dss)); assertEquals(dss.setIdOf(0), dss.setIdOf(1)); assertEquals(dss.setIdOf(0), dss.setIdOf(1)); assertNotEquals(dss.setIdOf(0), dss.setIdOf(2)); assertNotEquals(dss.setIdOf(0), dss.setIdOf(3)); assertNotEquals(dss.setIdOf(2), dss.setIdOf(3)); }
@Test void shouldRunWithLessInitialCommunitiesAndOverlappingIdSpace() { NodeProperties communities = new TestNodeProperties(0, 3, 1, 3); SequentialDisjointSetStruct dss = newSet(4, communities); assertEquals(3, getSetCount(dss)); assertEquals(dss.setIdOf(0), dss.setIdOf(1)); assertEquals(dss.setIdOf(0), dss.setIdOf(1)); assertNotEquals(dss.setIdOf(0), dss.setIdOf(2)); assertNotEquals(dss.setIdOf(0), dss.setIdOf(3)); assertNotEquals(dss.setIdOf(2), dss.setIdOf(3)); }