Initial opendaylight infrastructure commit!!
[controller.git] / third-party / net.sf.jung2 / src / main / java / edu / uci / ics / jung / algorithms / scoring / BarycenterScorer.java
1 /*
2  * Created on Jul 12, 2007
3  *
4  * Copyright (c) 2007, the JUNG Project and the Regents of the University 
5  * of California
6  * All rights reserved.
7  *
8  * This software is open-source under the BSD license; see either
9  * "license.txt" or
10  * http://jung.sourceforge.net/license.txt for a description.
11  */
12 package edu.uci.ics.jung.algorithms.scoring;
13
14 import org.apache.commons.collections15.Transformer;
15
16 import edu.uci.ics.jung.algorithms.shortestpath.Distance;
17 import edu.uci.ics.jung.graph.Hypergraph;
18
19 /**
20  * Assigns scores to each vertex according to the sum of its distances to all other vertices.
21  */
22 public class BarycenterScorer<V,E> extends DistanceCentralityScorer<V, E>
23 {
24     /**
25      * Creates an instance with the specified graph and distance metric.
26      * @param graph the input graph
27      * @param distance the distance metric to use
28      */
29     public BarycenterScorer(Hypergraph<V,E> graph, Distance<V> distance)
30     {
31         super(graph, distance, false);
32     }
33     
34     /**
35      * Creates an instance with the specified graph and edge weights.
36      * Will generate a <code>Distance</code> metric internally based on the edge weights. 
37      * @param graph the input graph
38      * @param edge_weights the edge weights to use to calculate vertex/vertex distances
39      */
40     public BarycenterScorer(Hypergraph<V,E> graph, Transformer<E, ? extends Number> edge_weights)
41     {
42         super(graph, edge_weights, false);
43     }
44
45     /**
46      * Creates an instance with the specified graph.
47      * Will generate a <code>Distance</code> metric internally assuming that the
48      * graph is unweighted. 
49      * @param graph the input graph
50      */
51     public BarycenterScorer(Hypergraph<V,E> graph)
52     {
53         super(graph, false);
54     }
55 }