Record Class CommunityDetectionUtil.CommunityResult<V>

java.lang.Object
java.lang.Record
cloud.opencode.base.graph.algorithm.CommunityDetectionUtil.CommunityResult<V>
Type Parameters:
V - the vertex type - 顶点类型
Record Components:
communities - the detected communities - 检测到的社区
vertexToCommunity - mapping from vertex to community index - 顶点到社区索引的映射
modularity - the modularity score - 模块度分数
iterations - number of iterations performed - 执行的迭代次数
Enclosing class:
CommunityDetectionUtil

public static record CommunityDetectionUtil.CommunityResult<V>(List<Set<V>> communities, Map<V,Integer> vertexToCommunity, double modularity, int iterations) extends Record
Community detection result. 社区检测结果。
Since:
JDK 25, opencode-base-graph V1.0.0
Author:
Leon Soo www.LeonSoo.com
  • Constructor Details

    • CommunityResult

      public CommunityResult(List<Set<V>> communities, Map<V,Integer> vertexToCommunity, double modularity, int iterations)
      Creates an instance of a CommunityResult record class.
      Parameters:
      communities - the value for the communities record component
      vertexToCommunity - the value for the vertexToCommunity record component
      modularity - the value for the modularity record component
      iterations - the value for the iterations record component
  • Method Details

    • communityCount

      public int communityCount()
      Gets the number of communities. 获取社区数量。
    • getCommunityOf

      public Set<V> getCommunityOf(V vertex)
      Gets the community containing a vertex. 获取包含顶点的社区。
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • communities

      public List<Set<V>> communities()
      Returns the value of the communities record component.
      Returns:
      the value of the communities record component
    • vertexToCommunity

      public Map<V,Integer> vertexToCommunity()
      Returns the value of the vertexToCommunity record component.
      Returns:
      the value of the vertexToCommunity record component
    • modularity

      public double modularity()
      Returns the value of the modularity record component.
      Returns:
      the value of the modularity record component
    • iterations

      public int iterations()
      Returns the value of the iterations record component.
      Returns:
      the value of the iterations record component