2 * Created on Jul 6, 2007
4 * Copyright (c) 2007, the JUNG Project and the Regents of the University
8 * This software is open-source under the BSD license; see either
10 * http://jung.sourceforge.net/license.txt for a description.
12 package edu.uci.ics.jung.algorithms.scoring;
14 import edu.uci.ics.jung.graph.Hypergraph;
17 * Assigns a score to each vertex equal to its degree.
19 * @param <V> the vertex type
21 public class DegreeScorer<V> implements VertexScorer<V,Integer>
24 * The graph for which scores are to be generated.
26 protected Hypergraph<V,?> graph;
29 * Creates an instance for the specified graph.
30 * @param graph the input graph
32 public DegreeScorer(Hypergraph<V,?> graph)
38 * Returns the degree of the vertex.
39 * @return the degree of the vertex
41 public Integer getVertexScore(V v)
43 return graph.degree(v);