final ReadAnchoring anchoring, final boolean backwards,
final MultiDeBruijnVertex leftVertex, final MultiDeBruijnVertex rightVertex) {
MultiDeBruijnVertex currentVertex = backwards ? rightVertex : leftVertex;
boolean foundEvent = false;
final CountSet pathSizes = new CountSet(10); // typically more than enough.
pathSizes.setTo(0);
// Map between reference vertices where there is some expected open alternative path rejoining and the
// predicted length of paths rejoining at that point counting from the beginning of the block.
final Map<MultiDeBruijnVertex, CountSet> expectedAlternativePathRejoins = new HashMap<>(4);
// Keeps record of possible left-clipping veritces; those that are located before any event path furcation
// has been found. The value indicates the blockLength at the time we traverse that node.
final Deque<Pair<MultiDeBruijnVertex, Integer>> possibleClippingPoints = new LinkedList<>();
// We keep the distance from the beggining of the block (leftVertex).
int blockLength = 0;
while (currentVertex != null) {
int openingDegree = backwards ? graph.outDegreeOf(currentVertex) : graph.inDegreeOf(currentVertex);
if (openingDegree > 1) {
final CountSet joiningPathLengths = expectedAlternativePathRejoins.remove(currentVertex);
if (joiningPathLengths != null)
pathSizes.addAll(joiningPathLengths);
}
final boolean isValidBlockEnd = isValidBlockEnd(anchoring, currentVertex, expectedAlternativePathRejoins);
if (foundEvent && isValidBlockEnd) // !gotcha we found a valid block end.