2 * Copyright (c) 2003, the JUNG Project and the Regents of the University
6 * This software is open-source under the BSD license; see either
8 * http://jung.sourceforge.net/license.txt for a description.
10 package edu.uci.ics.jung.algorithms.importance;
12 import java.util.HashMap;
18 * This class provides basic infrastructure for relative authority algorithms that compute the importance of nodes
19 * relative to one or more root nodes. The services provided are:
21 * <li>The set of root nodes (priors) is stored and maintained</li>
22 * <li>Getters and setters for the prior rank score are provided</li>
27 public abstract class RelativeAuthorityRanker<V,E> extends AbstractRanker<V,E> {
28 private Set<V> mPriors;
30 * The default key used for the user datum key corresponding to prior rank scores.
33 protected Map<V,Number> priorRankScoreMap = new HashMap<V,Number>();
35 * Cleans up all of the prior rank scores on finalize.
38 protected void finalizeIterations() {
39 super.finalizeIterations();
40 priorRankScoreMap.clear();
44 * Retrieves the value of the prior rank score.
45 * @param v the root node (prior)
46 * @return the prior rank score
48 protected double getPriorRankScore(V v) {
49 return priorRankScoreMap.get(v).doubleValue();
54 * Allows the user to specify a value to set for the prior rank score
55 * @param v the root node (prior)
56 * @param value the score to set to
58 public void setPriorRankScore(V v, double value) {
59 this.priorRankScoreMap.put(v, value);
63 * Retrieves the set of priors.
64 * @return the set of root nodes (priors)
66 protected Set<V> getPriors() { return mPriors; }
69 * Specifies which vertices are root nodes (priors).
70 * @param priors the root nodes
72 protected void setPriors(Set<V> priors) { mPriors = priors; }