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 Details

    • CommunityMeasure

      public CommunityMeasure​(String marker)
      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 the Algorithm.compute() method to initialize or reset the algorithm according to the new given graph.
      Specified by:
      init in interface Algorithm
      Parameters:
      graph - The graph this algorithm is using.
    • compute

      public abstract void compute()
      Description copied from interface: Algorithm
      Run the algorithm. The Algorithm.init(Graph) method has to be called before computing.
      Specified by:
      compute in interface Algorithm
      See Also:
      Algorithm.init(Graph)
    • terminate

      public void terminate()
      Description copied from interface: DynamicAlgorithm
      Terminate the dynamic algorithm.
      Specified by:
      terminate in interface DynamicAlgorithm
      See Also:
      Algorithm.init(org.graphstream.graph.Graph)
    • nodeAdded

      public void nodeAdded​(String graphId, long timeId, String nodeId)
      Specified by:
      nodeAdded in interface org.graphstream.stream.ElementSink
      Overrides:
      nodeAdded in class org.graphstream.stream.SinkAdapter
    • nodeRemoved

      public void nodeRemoved​(String graphId, long timeId, String nodeId)
      Specified by:
      nodeRemoved in interface org.graphstream.stream.ElementSink
      Overrides:
      nodeRemoved in class org.graphstream.stream.SinkAdapter
    • edgeAdded

      public void edgeAdded​(String graphId, long timeId, String edgeId, String fromNodeId, String toNodeId, boolean directed)
      Specified by:
      edgeAdded in interface org.graphstream.stream.ElementSink
      Overrides:
      edgeAdded in class org.graphstream.stream.SinkAdapter
    • edgeRemoved

      public void edgeRemoved​(String graphId, long timeId, String edgeId)
      Specified by:
      edgeRemoved in interface org.graphstream.stream.ElementSink
      Overrides:
      edgeRemoved in class org.graphstream.stream.SinkAdapter
    • graphCleared

      public void graphCleared​(String graphId, long timeId)
      Specified by:
      graphCleared in interface org.graphstream.stream.ElementSink
      Overrides:
      graphCleared in class org.graphstream.stream.SinkAdapter
    • nodeAttributeAdded

      public void nodeAttributeAdded​(String graphId, long timeId, String nodeId, String attribute, Object value)
      Specified by:
      nodeAttributeAdded in interface org.graphstream.stream.AttributeSink
      Overrides:
      nodeAttributeAdded in class org.graphstream.stream.SinkAdapter
    • nodeAttributeChanged

      public void nodeAttributeChanged​(String graphId, long timeId, String nodeId, String attribute, Object oldValue, Object newValue)
      Specified by:
      nodeAttributeChanged in interface org.graphstream.stream.AttributeSink
      Overrides:
      nodeAttributeChanged in class org.graphstream.stream.SinkAdapter