Record Class BipartiteUtil.BipartiteResult<V>

java.lang.Object
java.lang.Record
cloud.opencode.base.graph.algorithm.BipartiteUtil.BipartiteResult<V>
Type Parameters:
V - the vertex type | 顶点类型
Record Components:
bipartite - whether the graph is bipartite | 图是否为二部图
left - the left partition (empty if not bipartite) | 左分区(非二部图时为空)
right - the right partition (empty if not bipartite) | 右分区(非二部图时为空)
oddCycle - the odd cycle witness (empty if bipartite) | 奇数环证据(二部图时为空)
Enclosing class:
BipartiteUtil

public static record BipartiteUtil.BipartiteResult<V>(boolean bipartite, Set<V> left, Set<V> right, List<V> oddCycle) extends Record
Result of bipartite check containing partition sets or odd cycle witness. 二部图检查结果,包含分区集合或奇数环证据。
Since:
JDK 25, opencode-base-graph V1.0.3
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Constructor Details

    • BipartiteResult

      public BipartiteResult(boolean bipartite, Set<V> left, Set<V> right, List<V> oddCycle)
      Creates an instance of a BipartiteResult record class.
      Parameters:
      bipartite - the value for the bipartite record component
      left - the value for the left record component
      right - the value for the right record component
      oddCycle - the value for the oddCycle record component
  • Method Details

    • ofBipartite

      public static <V> BipartiteUtil.BipartiteResult<V> ofBipartite(Set<V> left, Set<V> right)
      Create a bipartite result with left and right partitions. 创建包含左右分区的二部图结果。
      Type Parameters:
      V - the vertex type | 顶点类型
      Parameters:
      left - the left partition | 左分区
      right - the right partition | 右分区
      Returns:
      bipartite result | 二部图结果
    • ofNotBipartite

      public static <V> BipartiteUtil.BipartiteResult<V> ofNotBipartite(List<V> oddCycle)
      Create a not-bipartite result with an odd cycle witness. 创建包含奇数环证据的非二部图结果。
      Type Parameters:
      V - the vertex type | 顶点类型
      Parameters:
      oddCycle - the odd cycle witness | 奇数环证据
      Returns:
      not-bipartite result | 非二部图结果
    • 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.
    • bipartite

      public boolean bipartite()
      Returns the value of the bipartite record component.
      Returns:
      the value of the bipartite record component
    • left

      public Set<V> left()
      Returns the value of the left record component.
      Returns:
      the value of the left record component
    • right

      public Set<V> right()
      Returns the value of the right record component.
      Returns:
      the value of the right record component
    • oddCycle

      public List<V> oddCycle()
      Returns the value of the oddCycle record component.
      Returns:
      the value of the oddCycle record component