Interface IVertexBiPartition
-
- All Superinterfaces:
IVertexPartition,VertexBiPartition<Integer,Integer>,VertexPartition<Integer,Integer>
public interface IVertexBiPartition extends IVertexPartition, VertexBiPartition<Integer,Integer>
A partition of the vertices of an int graph into two blocks.This interface is a specific version of
VertexBiPartitionforIntGraph. SeeVertexBiPartitionfor the complete documentation.- Author:
- Barak Ugav
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default IntSetcrossEdges()Get the edges that cross between the left and right blocks.static IVertexBiPartitionfromMap(IntGraph g, Map<Integer,Boolean> map)Create a new vertex bi-partition from a vertex-side map.static IVertexBiPartitionfromMapping(IntGraph g, IntPredicate mapping)Create a new vertex bi-partition from a vertex-side mapping function.booleanisLeft(int vertex)Check whether a vertex is contained in the left block (block 0).default booleanisLeft(Integer vertex)Deprecated.Please useisLeft(int)instead to avoid un/boxing.static booleanisPartition(IntGraph g, IntPredicate mapping)Check if a mapping is a valid bi-partition of the vertices of a graph.default booleanisRight(int vertex)Check whether a vertex is contained in the right block (block 1).default booleanisRight(Integer vertex)Deprecated.Please useisRight(int)instead to avoid un/boxing.default IntSetleftEdges()Get the edges that are contained in the left block.default IntSetleftVertices()Get the vertices in the 'left' block.default IntSetrightEdges()Get the edges that are contained in the right block.default IntSetrightVertices()Get the vertices in the 'right' block.default intvertexBlock(int vertex)Get the block containing a vertex.default intvertexBlock(Integer vertex)Deprecated.Please usevertexBlock(int)instead to avoid un/boxing.-
Methods inherited from interface com.jgalgo.alg.IVertexPartition
blockEdges, blocksGraph, blocksGraph, blockSubGraph, blockSubGraph, blockVertices, crossEdges, graph
-
Methods inherited from interface com.jgalgo.alg.VertexBiPartition
numberOfBlocks
-
-
-
-
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:
trueif the vertex is contained in the left block,falseotherwise
-
isLeft
@Deprecated default boolean isLeft(Integer vertex)
Deprecated.Please useisLeft(int)instead to avoid un/boxing.Check whether a vertex is contained in the left block (block 0).- Specified by:
isLeftin interfaceVertexBiPartition<Integer,Integer>- Parameters:
vertex- a vertex in the graph- Returns:
trueif the vertex is contained in the left block,falseotherwise
-
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:
trueif the vertex is contained in the right block,falseotherwise
-
isRight
@Deprecated default boolean isRight(Integer vertex)
Deprecated.Please useisRight(int)instead to avoid un/boxing.Check whether a vertex is contained in the right block (block 1).- Specified by:
isRightin interfaceVertexBiPartition<Integer,Integer>- Parameters:
vertex- a vertex in the graph- Returns:
trueif the vertex is contained in the right block,falseotherwise
-
vertexBlock
default int vertexBlock(int vertex)
Description copied from interface:IVertexPartitionGet the block containing a vertex.- Specified by:
vertexBlockin interfaceIVertexPartition- Parameters:
vertex- a vertex in the graph- Returns:
- index of the block containing the vertex, in range \([0, blocksNum)\)
-
vertexBlock
@Deprecated default int vertexBlock(Integer vertex)
Deprecated.Please usevertexBlock(int)instead to avoid un/boxing.Get the block containing a vertex.- Specified by:
vertexBlockin interfaceIVertexPartition- Specified by:
vertexBlockin interfaceVertexBiPartition<Integer,Integer>- Specified by:
vertexBlockin interfaceVertexPartition<Integer,Integer>- Parameters:
vertex- a vertex in the graph- Returns:
- index of the block containing the vertex, in range \([0, blocksNum)\)
-
leftVertices
default IntSet leftVertices()
Description copied from interface:VertexBiPartitionGet the vertices in the 'left' block.The left block is the block with index 0.
- Specified by:
leftVerticesin interfaceVertexBiPartition<Integer,Integer>- Returns:
- the vertices in the left block
-
rightVertices
default IntSet rightVertices()
Description copied from interface:VertexBiPartitionGet the vertices in the 'right' block.The right block is the block with index 1.
- Specified by:
rightVerticesin interfaceVertexBiPartition<Integer,Integer>- Returns:
- the vertices in the right block
-
leftEdges
default IntSet leftEdges()
Description copied from interface:VertexBiPartitionGet 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:
leftEdgesin interfaceVertexBiPartition<Integer,Integer>- Returns:
- the edges that are contained in the left block
-
rightEdges
default IntSet rightEdges()
Description copied from interface:VertexBiPartitionGet 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:
rightEdgesin interfaceVertexBiPartition<Integer,Integer>- Returns:
- the edges that are contained in the right block
-
crossEdges
default IntSet crossEdges()
Description copied from interface:VertexBiPartitionGet 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:
crossEdgesin interfaceVertexBiPartition<Integer,Integer>- Returns:
- the edges that cross between the left and right blocks
-
fromMap
static IVertexBiPartition fromMap(IntGraph g, Map<Integer,Boolean> map)
Create a new vertex bi-partition from a vertex-side map.Note that this function does not validate the input. For that, see
isPartition(IntGraph, IntPredicate).- Parameters:
g- the graphmap- a map from vertex to eithertrueorfalse- Returns:
- a new vertex bi-partition
-
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 graphmapping- a mapping function that maps from a vertex to eithertrueorfalse- 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
trueorfalse, in which there are not 'empty blocks', namely at least one vertex is mapped totrueand another one is mapped totrue.- Parameters:
g- the graphmapping- a mapping function that maps from a vertex to eithertrueorfalse- Returns:
trueif the mapping is a valid bi-partition of the vertices of the graph,falseotherwise
-
-