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 voidcompute()Run the algorithm.voidedgeAdded(String graphId, long timeId, String edgeId, String fromNodeId, String toNodeId, boolean directed)voidedgeRemoved(String graphId, long timeId, String edgeId)doublegetLastComputedValue()The last computed measure.doublegetMeasure()Compute the measure (if the graph changed since the last computation).voidgraphCleared(String graphId, long timeId)voidinit(org.graphstream.graph.Graph graph)Initialization of the algorithm.voidnodeAdded(String graphId, long timeId, String nodeId)voidnodeAttributeAdded(String graphId, long timeId, String nodeId, String attribute, Object value)voidnodeAttributeChanged(String graphId, long timeId, String nodeId, String attribute, Object oldValue, Object newValue)voidnodeRemoved(String graphId, long timeId, String nodeId)voidterminate()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:AlgorithmInitialization 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:AlgorithmRun the algorithm. TheAlgorithm.init(Graph)method has to be called before computing.- Specified by:
computein interfaceAlgorithm- See Also:
Algorithm.init(Graph)
-
terminate
public void terminate()Description copied from interface:DynamicAlgorithmTerminate the dynamic algorithm.- Specified by:
terminatein interfaceDynamicAlgorithm- See Also:
Algorithm.init(org.graphstream.graph.Graph)
-
nodeAdded
- Specified by:
nodeAddedin interfaceorg.graphstream.stream.ElementSink- Overrides:
nodeAddedin classorg.graphstream.stream.SinkAdapter
-
nodeRemoved
- Specified by:
nodeRemovedin interfaceorg.graphstream.stream.ElementSink- Overrides:
nodeRemovedin classorg.graphstream.stream.SinkAdapter
-
edgeAdded
public void edgeAdded(String graphId, long timeId, String edgeId, String fromNodeId, String toNodeId, boolean directed)- Specified by:
edgeAddedin interfaceorg.graphstream.stream.ElementSink- Overrides:
edgeAddedin classorg.graphstream.stream.SinkAdapter
-
edgeRemoved
- Specified by:
edgeRemovedin interfaceorg.graphstream.stream.ElementSink- Overrides:
edgeRemovedin classorg.graphstream.stream.SinkAdapter
-
graphCleared
- Specified by:
graphClearedin interfaceorg.graphstream.stream.ElementSink- Overrides:
graphClearedin classorg.graphstream.stream.SinkAdapter
-
nodeAttributeAdded
public void nodeAttributeAdded(String graphId, long timeId, String nodeId, String attribute, Object value)- Specified by:
nodeAttributeAddedin interfaceorg.graphstream.stream.AttributeSink- Overrides:
nodeAttributeAddedin classorg.graphstream.stream.SinkAdapter
-
nodeAttributeChanged
public void nodeAttributeChanged(String graphId, long timeId, String nodeId, String attribute, Object oldValue, Object newValue)- Specified by:
nodeAttributeChangedin interfaceorg.graphstream.stream.AttributeSink- Overrides:
nodeAttributeChangedin classorg.graphstream.stream.SinkAdapter
-