Interface IVertexBiPartition

    • Method Detail

      • isLeft

        boolean isLeft​(int vertex)
        Check whether a vertex is contained in the left block (block 0).
        Parameters:
        vertex - a vertex in the graph
        Returns:
        true if the vertex is contained in the left block, false otherwise
      • isLeft

        @Deprecated
        default boolean isLeft​(Integer vertex)
        Deprecated.
        Description copied from interface: VertexBiPartition
        Check whether a vertex is contained in the left block (block 0).
        Specified by:
        isLeft in interface VertexBiPartition<Integer,​Integer>
        Parameters:
        vertex - a vertex in the graph
        Returns:
        true if the vertex is contained in the left block, false otherwise
      • isRight

        default boolean isRight​(int vertex)
        Check whether a vertex is contained in the right block (block 1).
        Parameters:
        vertex - a vertex in the graph
        Returns:
        true if the vertex is contained in the right block, false otherwise
      • vertexBlock

        default int vertexBlock​(int vertex)
        Description copied from interface: IVertexPartition
        Get the block containing a vertex.
        Specified by:
        vertexBlock in interface IVertexPartition
        Parameters:
        vertex - a vertex in the graph
        Returns:
        index of the block containing the vertex, in range \([0, blocksNum)\)
      • leftEdges

        default IntSet leftEdges()
        Description copied from interface: VertexBiPartition
        Get the edges that are contained in the left block.

        The left block is the block with index 0, and edges contained in it are edges with both endpoints in the left block.

        Specified by:
        leftEdges in interface VertexBiPartition<Integer,​Integer>
        Returns:
        the edges that are contained in the left block
      • rightEdges

        default IntSet rightEdges()
        Description copied from interface: VertexBiPartition
        Get the edges that are contained in the right block.

        The right block is the block with index 1, and edges contained in it are edges with both endpoints in the right block.

        Specified by:
        rightEdges in interface VertexBiPartition<Integer,​Integer>
        Returns:
        the edges that are contained in the right block
      • crossEdges

        default IntSet crossEdges()
        Description copied from interface: VertexBiPartition
        Get the edges that cross between the left and right blocks.

        An edge \((u,v)\) is said to cross between two blocks \(b_1\) and \(b_2\) if \(u\) is contained in \(b_1\) and \(v\) is contained in \(b_2\). Note that if the graph is directed, the cross edges of \((b_1,b_2)\) are different that \((b_2,b_1)\), since the direction of the edge matters. In that case, the edges returned by this functions are edges sourced in the left block and targeted in the right block. To get the edges sourced in the right block and targeted in the left block, use crossEdges(1, 0).

        Specified by:
        crossEdges in interface VertexBiPartition<Integer,​Integer>
        Returns:
        the edges that cross between the left and right blocks
      • fromMapping

        static IVertexBiPartition fromMapping​(IntGraph g,
                                              IntPredicate mapping)
        Create a new vertex bi-partition from a vertex-side mapping function.

        Note that this function does not validate the input. For that, see isPartition(IntGraph, IntPredicate).

        Parameters:
        g - the graph
        mapping - a mapping function that maps from a vertex to either true or false
        Returns:
        a new vertex bi-partition
      • isPartition

        static boolean isPartition​(IntGraph g,
                                   IntPredicate mapping)
        Check if a mapping is a valid bi-partition of the vertices of a graph.

        A valid vertex bi-partition is a mapping from each vertex to either true or false, in which there are not 'empty blocks', namely at least one vertex is mapped to true and another one is mapped to true.

        Parameters:
        g - the graph
        mapping - a mapping function that maps from a vertex to either true or false
        Returns:
        true if the mapping is a valid bi-partition of the vertices of the graph, false otherwise