Interface IVertexBiPartition
- All Superinterfaces:
IVertexPartition,VertexBiPartition<Integer,,Integer> VertexPartition<Integer,Integer>
This interface is a specification of VertexBiPartition for IntGraph. See VertexBiPartition
for the complete documentation.
- Author:
- Barak Ugav
-
Method Summary
Modifier and TypeMethodDescriptiondefault IntSetGet the edges that cross between the left and right blocks.static IVertexBiPartitionfromBitmap(IndexGraph g, com.jgalgo.internal.util.Bitmap bitmap) Create a new vertex bi-partition from a bitmap.static IVertexBiPartitionCreate 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.static IVertexBiPartitionfromWeights(IntGraph g, IWeightsBool weights) Create a new vertex bi-partition from a vertex-side weights container.booleanisLeft(int vertex) Check whether a vertex is contained in the left block (block 0).default booleanDeprecated.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 booleanDeprecated.Please useisRight(int)instead to avoid un/boxing.default IntSetGet the edges that are contained in the left block.default IntSetGet the vertices in the 'left' block.default IntSetGet the edges that are contained in the right block.default IntSetGet 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.common.IVertexPartition
blockEdges, blocksGraph, blocksGraph, blockSubGraph, blockSubGraph, blockVertices, crossEdges, graphMethods inherited from interface com.jgalgo.alg.common.VertexBiPartition
numberOfBlocks
-
Method Details
-
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.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.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.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
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
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
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
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
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
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
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, wheretruemeans the vertex is contained in the left block andfalsemeans the vertex is contained in the right block- Returns:
- a new vertex bi-partition
-
fromWeights
Create a new vertex bi-partition from a vertex-side weights container.- Parameters:
g- the graphweights- a weights container that maps from a vertex to eithertrueorfalse, wheretruemeans the vertex is contained in the left block andfalsemeans the vertex is contained in the right block- Returns:
- a new vertex bi-partition
-
fromBitmap
Create a new vertex bi-partition from a bitmap.This function can be used only for index graphs.
- Parameters:
g- the index graphbitmap- a bitmap wheretruemeans the vertex is contained in the left block andfalsemeans the vertex is contained in the right block. The bitmap is not copied, and it is assumed the caller of this function will not modify the bitmap after calling this function- Returns:
- a new vertex bi-partition
-
isPartition
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
-
isLeft(int)instead to avoid un/boxing.