001    /*
002     * Copyright (c) 1998-2014 ChemAxon Ltd. All Rights Reserved.
003     *
004     * This software is the confidential and proprietary information of
005     * ChemAxon. You shall not disclose such Confidential Information
006     * and shall use it only in accordance with the terms of the agreements
007     * you entered into with ChemAxon.
008     *
009     */
010    
011    package com.chemaxon.clustering.wards;
012    
013    import com.chemaxon.common.annotations.PublicAPI;
014    import com.google.common.annotations.Beta;
015    
016    /**
017     * Instances represent a cluster distance update for agglomerative clusterings.
018     *
019     * <p>Please note that this interface is marked with {@link Beta} annotation, so it can be subject of incompatible
020     * changes or  removal in later releases.</p>
021     *
022     * @see LanceWilliamsAlgorithm
023     * @see <a href="http://en.wikipedia.org/wiki/Ward%27s_method#Lance.E2.80.93Williams_algorithms">http://en.wikipedia.org/wiki/Ward%27s_method#Lance.E2.80.93Williams_algorithms</a>
024     *
025     * @author Gabor Imre
026     */
027    @Beta
028    @PublicAPI
029    public interface LanceWilliamsMerge {
030    
031        /**
032         * Returns the distance of cluster k and the cluster resulted from merging cluster i and j.
033         *
034         * @param ni    Size of cluster i to be merged
035         * @param nj    Size of cluster j to be merged
036         * @param nk    Size of cluster k
037         * @param dij   Distance of clusters i and j
038         * @param dik   Distance of clusters i and k
039         * @param djk   Distance of clusters j and k
040         * @return      Distance of cluster k and cluster i-j merged
041         */
042        double dijk(int ni, int nj, int nk, double dij, double dik, double djk);
043    }