Initial opendaylight infrastructure commit!!
[controller.git] / third-party / net.sf.jung2 / src / main / java / edu / uci / ics / jung / algorithms / scoring / EigenvectorCentrality.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.graph.Hypergraph;
17
18 /**
19  * Calculates eigenvector centrality for each vertex in the graph.
20  * The 'eigenvector centrality' for a vertex is defined as the fraction of
21  * time that a random walk(er) will spend at that vertex over an infinite
22  * time horizon.
23  * Assumes that the graph is strongly connected.
24  */
25 public class EigenvectorCentrality<V,E> extends PageRank<V,E>
26 {
27     /**
28      * Creates an instance with the specified graph and edge weights.
29      * The outgoing edge weights for each edge must sum to 1.
30      * (See <code>UniformDegreeWeight</code> for one way to handle this for
31      * undirected graphs.)
32      * @param graph the graph for which the centrality is to be calculated
33      * @param edge_weights the edge weights 
34      */
35     public EigenvectorCentrality(Hypergraph<V,E> graph, 
36                 Transformer<E, ? extends Number> edge_weights)
37     {
38         super(graph, edge_weights, 0);
39         acceptDisconnectedGraph(false);
40     }
41
42     /**
43      * Creates an instance with the specified graph and default edge weights.
44      * (Default edge weights: <code>UniformDegreeWeight</code>.)
45      * @param graph the graph for which the centrality is to be calculated.
46      */
47     public EigenvectorCentrality(Hypergraph<V,E> graph)
48     {
49         super(graph, 0);
50         acceptDisconnectedGraph(false);
51     }
52 }