public class SurpriseMeasure extends Object implements Algorithm
Modifier and Type | Field and Description |
---|---|
static String |
ATTRIBUTE
Default attribute key where the result of the algorithm, a double value,
is stored.
|
Constructor and Description |
---|
SurpriseMeasure()
Default constructor.
|
SurpriseMeasure(String communityAttributeKey)
Constructor allowing to set the node attribute key containing index of
organizations.
|
SurpriseMeasure(String communityAttributeKey,
String surpriseAttributeKey)
Same as
SurpriseMeasure(String) but allowing to set the graph
attribute that will contain the result of the computation. |
Modifier and Type | Method and Description |
---|---|
static double |
binomialCoefficient(double n,
double r)
Helper to compute the binomial coefficient.
|
void |
compute()
Run the algorithm.
|
static double |
cumulativeHypergeometricDistribution(double xStart,
double xEnd,
double N,
double n,
double k)
Helper to compute the cumulative hypergeometric distribution.
|
double |
getSurprise()
Get the last computed surprise value contained in the graph.
|
static double |
hypergeometricDistribution(double x,
double N,
double n,
double k)
Helper to compute the hypergeometric distribution.
|
void |
init(org.graphstream.graph.Graph graph)
Initialization of the algorithm.
|
public static final String ATTRIBUTE
public SurpriseMeasure()
public SurpriseMeasure(String communityAttributeKey)
communityAttributeKey
- key attribute of organizationspublic SurpriseMeasure(String communityAttributeKey, String surpriseAttributeKey)
SurpriseMeasure(String)
but allowing to set the graph
attribute that will contain the result of the computation.communityAttributeKey
- surpriseAttributeKey
- public void init(org.graphstream.graph.Graph graph)
Algorithm
Algorithm.compute()
method to initialize or reset the algorithm according
to the new given graph.public void compute()
Algorithm
Algorithm.init(Graph)
method has to be called
before computing.compute
in interface Algorithm
Algorithm.init(Graph)
public double getSurprise()
public static double binomialCoefficient(double n, double r)
n
- r
- public static double hypergeometricDistribution(double x, double N, double n, double k)
x
- N
- n
- k
- public static double cumulativeHypergeometricDistribution(double xStart, double xEnd, double N, double n, double k)
xStart
- xEnd
- N
- n
- k
- Copyright © 2015. All rights reserved.