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 IntSet
Get the edges that cross between the left and right blocks.static IVertexBiPartition
fromBitmap
(IndexGraph g, com.jgalgo.internal.util.Bitmap bitmap) Create a new vertex bi-partition from a bitmap.static IVertexBiPartition
Create a new vertex bi-partition from a vertex-side map.static IVertexBiPartition
fromMapping
(IntGraph g, IntPredicate mapping) Create a new vertex bi-partition from a vertex-side mapping function.static IVertexBiPartition
fromWeights
(IntGraph g, IWeightsBool weights) Create a new vertex bi-partition from a vertex-side weights container.boolean
isLeft
(int vertex) Check whether a vertex is contained in the left block (block 0).default boolean
Deprecated.static boolean
isPartition
(IntGraph g, IntPredicate mapping) Check if a mapping is a valid bi-partition of the vertices of a graph.default boolean
isRight
(int vertex) Check whether a vertex is contained in the right block (block 1).default boolean
Deprecated.Please useisRight(int)
instead to avoid un/boxing.default IntSet
Get the edges that are contained in the left block.default IntSet
Get the vertices in the 'left' block.default IntSet
Get the edges that are contained in the right block.default IntSet
Get the vertices in the 'right' block.default int
vertexBlock
(int vertex) Get the block containing a vertex.default int
vertexBlock
(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, graph
Methods 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:
true
if the vertex is contained in the left block,false
otherwise
-
isLeft
Deprecated.Please useisLeft(int)
instead to avoid un/boxing.Check whether a vertex is contained in the left block (block 0).- Specified by:
isLeft
in interfaceVertexBiPartition<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
-
isRight
Deprecated.Please useisRight(int)
instead to avoid un/boxing.Check whether a vertex is contained in the right block (block 1).- Specified by:
isRight
in interfaceVertexBiPartition<Integer,
Integer> - 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 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:
vertexBlock
in interfaceIVertexPartition
- Specified by:
vertexBlock
in interfaceVertexBiPartition<Integer,
Integer> - Specified by:
vertexBlock
in 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:VertexBiPartition
Get the vertices in the 'left' block.The left block is the block with index 0.
- Specified by:
leftVertices
in interfaceVertexBiPartition<Integer,
Integer> - Returns:
- the vertices in the left block
-
rightVertices
Description copied from interface:VertexBiPartition
Get the vertices in the 'right' block.The right block is the block with index 1.
- Specified by:
rightVertices
in interfaceVertexBiPartition<Integer,
Integer> - Returns:
- the vertices in the right block
-
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 interfaceVertexBiPartition<Integer,
Integer> - Returns:
- the edges that are contained in the left block
-
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 interfaceVertexBiPartition<Integer,
Integer> - Returns:
- the edges that are contained in the right block
-
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 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 eithertrue
orfalse
- 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 eithertrue
orfalse
, wheretrue
means the vertex is contained in the left block andfalse
means 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 eithertrue
orfalse
, wheretrue
means the vertex is contained in the left block andfalse
means 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 wheretrue
means the vertex is contained in the left block andfalse
means 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
true
orfalse
, in which there are not 'empty blocks', namely at least one vertex is mapped totrue
and another one is mapped totrue
.- Parameters:
g
- the graphmapping
- a mapping function that maps from a vertex to eithertrue
orfalse
- Returns:
true
if the mapping is a valid bi-partition of the vertices of the graph,false
otherwise
-
isLeft(int)
instead to avoid un/boxing.