|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.graphstream.algorithm.measure.SurpriseMeasure
public class SurpriseMeasure
Surprise measure. Description from Wikipedia : Surprise (denoted S) is a measure of community structure in complex networks. The name Surprise derives from the fact that its maximization finds the most surprising partition into communities of the network, that is, the most unlikely one. S accurately evaluates, in a global manner, the quality of a partition using a cumulative hypergeometric distribution.
Field Summary | |
---|---|
static String |
ATTRIBUTE
Default attribute key where the result of the algorithm, a double value, is stored. |
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String ATTRIBUTE
Constructor Detail |
---|
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
- Method Detail |
---|
public void init(org.graphstream.graph.Graph graph)
Algorithm
Algorithm.compute()
method to initialize or reset the algorithm according
to the new given graph.
init
in interface Algorithm
graph
- The graph this algorithm is using.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
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |