Class CommunityMeasure
java.lang.Object
org.graphstream.stream.SinkAdapter
org.graphstream.algorithm.measure.CommunityMeasure
- All Implemented Interfaces:
Algorithm
,DynamicAlgorithm
,org.graphstream.stream.AttributeSink
,org.graphstream.stream.ElementSink
,org.graphstream.stream.Sink
- Direct Known Subclasses:
CommunityDistribution
,CommunityRelativeMeasure
,Modularity
public abstract class CommunityMeasure extends org.graphstream.stream.SinkAdapter implements DynamicAlgorithm
Computes and updates an absolute measure based on the current community
assignment on a given graph as it evolves.
- Author:
- Guillaume-Jean Herbiet
- Scientific Reference :
- M. E. Newman and M. Girvan, “Finding and Evaluating Community Structure in Networks,” Physical Review E (Statistical, Nonlinear, and Soft Matter Physics), vol. 69, no. 2, pp. 026 113+, Feb 2004.
-
Constructor Summary
Constructors Constructor Description CommunityMeasure(String marker)
New measure algorithm with a given marker for communities. -
Method Summary
Modifier and Type Method Description abstract void
compute()
Run the algorithm.void
edgeAdded(String graphId, long timeId, String edgeId, String fromNodeId, String toNodeId, boolean directed)
void
edgeRemoved(String graphId, long timeId, String edgeId)
double
getLastComputedValue()
The last computed measure.double
getMeasure()
Compute the measure (if the graph changed since the last computation).void
graphCleared(String graphId, long timeId)
void
init(org.graphstream.graph.Graph graph)
Initialization of the algorithm.void
nodeAdded(String graphId, long timeId, String nodeId)
void
nodeAttributeAdded(String graphId, long timeId, String nodeId, String attribute, Object value)
void
nodeAttributeChanged(String graphId, long timeId, String nodeId, String attribute, Object oldValue, Object newValue)
void
nodeRemoved(String graphId, long timeId, String nodeId)
void
terminate()
Terminate the dynamic algorithm.
-
Constructor Details
-
CommunityMeasure
New measure algorithm with a given marker for communities.- Parameters:
marker
- name of the attribute marking the communities.
-
-
Method Details
-
getLastComputedValue
public double getLastComputedValue()The last computed measure.- Returns:
- The last computed measure.
- Computational Complexity :
- O(1)
-
getMeasure
public double getMeasure()Compute the measure (if the graph changed since the last computation).- Returns:
- The current measure.
- Computational Complexity :
- Depends on the actual measure
-
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 abstract 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)
-
terminate
public void terminate()Description copied from interface:DynamicAlgorithm
Terminate the dynamic algorithm.- Specified by:
terminate
in interfaceDynamicAlgorithm
- See Also:
Algorithm.init(org.graphstream.graph.Graph)
-
nodeAdded
- Specified by:
nodeAdded
in interfaceorg.graphstream.stream.ElementSink
- Overrides:
nodeAdded
in classorg.graphstream.stream.SinkAdapter
-
nodeRemoved
- Specified by:
nodeRemoved
in interfaceorg.graphstream.stream.ElementSink
- Overrides:
nodeRemoved
in classorg.graphstream.stream.SinkAdapter
-
edgeAdded
public void edgeAdded(String graphId, long timeId, String edgeId, String fromNodeId, String toNodeId, boolean directed)- Specified by:
edgeAdded
in interfaceorg.graphstream.stream.ElementSink
- Overrides:
edgeAdded
in classorg.graphstream.stream.SinkAdapter
-
edgeRemoved
- Specified by:
edgeRemoved
in interfaceorg.graphstream.stream.ElementSink
- Overrides:
edgeRemoved
in classorg.graphstream.stream.SinkAdapter
-
graphCleared
- Specified by:
graphCleared
in interfaceorg.graphstream.stream.ElementSink
- Overrides:
graphCleared
in classorg.graphstream.stream.SinkAdapter
-
nodeAttributeAdded
public void nodeAttributeAdded(String graphId, long timeId, String nodeId, String attribute, Object value)- Specified by:
nodeAttributeAdded
in interfaceorg.graphstream.stream.AttributeSink
- Overrides:
nodeAttributeAdded
in classorg.graphstream.stream.SinkAdapter
-
nodeAttributeChanged
public void nodeAttributeChanged(String graphId, long timeId, String nodeId, String attribute, Object oldValue, Object newValue)- Specified by:
nodeAttributeChanged
in interfaceorg.graphstream.stream.AttributeSink
- Overrides:
nodeAttributeChanged
in classorg.graphstream.stream.SinkAdapter
-