Class AbstractCentrality
java.lang.Object
org.graphstream.algorithm.measure.AbstractCentrality
- All Implemented Interfaces:
Algorithm
- Direct Known Subclasses:
ClosenessCentrality
,DegreeCentrality
,EigenvectorCentrality
public abstract class AbstractCentrality extends Object implements Algorithm
Base class for centrality measures. Subclasses should implements a
computeCentrality()
method where centrality values will be stored in
data
.-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractCentrality.NormalizationMode
-
Method Summary
Modifier and Type Method Description void
compute()
Run the algorithm.void
copyValuesTo(String attribute)
Copy values previously computed to a specific attribute.void
copyValuesTo(String attribute, AbstractCentrality.NormalizationMode normalize)
Copy values previously computed to a specific attribute.String
defaultMessage()
String
getCentralityAttribute()
Getter forcentralityAttribute
.AbstractCentrality.NormalizationMode
getNormalizationMode()
Getter fornormalize
.void
init(org.graphstream.graph.Graph graph)
Initialization of the algorithm.void
setCentralityAttribute(String centralityAttribute)
Setter forcentralityAttribute
.void
setNormalizationMode(AbstractCentrality.NormalizationMode normalize)
Setter fornormalize
.
-
Method Details
-
init
public void init(org.graphstream.graph.Graph graph)Description copied from interface:Algorithm
Initialization of the algorithm. This method has to be called before theAlgorithm.compute()
method to initialize or reset the algorithm according to the new given graph. -
compute
public void compute()Description copied from interface:Algorithm
Run the algorithm. TheAlgorithm.init(Graph)
method has to be called before computing.- Specified by:
compute
in interfaceAlgorithm
- See Also:
Algorithm.init(Graph)
-
copyValuesTo
Copy values previously computed to a specific attribute. Thecompute()
method needs to have been call before calling this one.- Parameters:
attribute
- destination attribute where values of centrality will be stored
-
copyValuesTo
Copy values previously computed to a specific attribute. Thecompute()
method needs to have been call before calling this one.- Parameters:
attribute
- destination attribute where values of centrality will be storednormalize
- defines the way that values have to be normalized
-
getCentralityAttribute
Getter forcentralityAttribute
.- Returns:
centralityAttribute
-
setCentralityAttribute
Setter forcentralityAttribute
.- Parameters:
centralityAttribute
- new value ofcentralityAttribute
-
getNormalizationMode
Getter fornormalize
.- Returns:
normalize
-
setNormalizationMode
Setter fornormalize
.- Parameters:
normalize
- new value ofnormalize
-
defaultMessage
-