use of com.b2international.commons.graph.LongTarjan in project snow-owl by b2ihealthcare.
the class LongTarjanTest method smallBatchSize.
@Test
public void smallBatchSize() throws Exception {
final LongKeyLongMap followerMap = PrimitiveMaps.newLongKeyLongOpenHashMap();
followerMap.put(1, 2);
followerMap.put(2, 3);
followerMap.put(3, 4);
followerMap.put(4, 1);
followerMap.put(5, 3);
followerMap.put(6, 2);
followerMap.put(7, 8);
followerMap.put(8, 6);
final LongTarjan tarjan = new LongTarjan(3, currentId -> LongCollections.singletonSet(followerMap.get(currentId)));
final List<LongSet> actual = tarjan.run(followerMap.keySet());
assertEquals(ImmutableList.of(PrimitiveSets.newLongOpenHashSet(1L, 2L, 3L, 4L), PrimitiveSets.newLongOpenHashSet(5L, 6L, 8L), PrimitiveSets.newLongOpenHashSet(7L)), actual);
}
Aggregations