/** * Creates a new {@code MatrixBasedTermSimilarityNetwork}. * * @param termIndex The index of terms that contains the nodes of the network. * @param similarities The square matrix of similarities between terms. Must have a number of rows * and columns equal to the number of terms in the term index. */ public MatrixBasedTermSimilarityNetwork(final TermIndex termIndex, final Matrix similarities) { super(); if (similarities.getNumRows() != termIndex.getTermCount() || similarities.getNumColumns() != termIndex.getTermCount()) { throw new DimensionalityMismatchException( "the number of terms in the term index must match the " + "dimensions of the square similarities matrix"); } this.setTermIndex(termIndex); this.setSimilarities(similarities); }