class PackageGraph implements ProgressCheck {

    public boolean isLeftDescendantOfRight(final @NotNull PackageId left, final @NotNull PackageId right) {
        if (left.equals(right)) {
            return true;
        }
        return Optional.ofNullable(getOrCreateNode(left).getParent())
                .map(parent -> isLeftDescendantOfRight(parent.getId(), right))
                .orElse(false);
    }

}