Package com.alibaba.graphscope.ds
Class VertexSet
- java.lang.Object
-
- com.alibaba.graphscope.ds.VertexSet
-
public class VertexSet extends Object
VertexSet UsesBitSet
as underlying data structure to mark the presence of a vertex. It provides interfaces which works along withVertex
andVertexRange
. Feel free to use VertexSet in your app.Right index is exclusive We don't want to introduce synchronization cost, so the underlying backend is a no-thread-safe bitset.
bitSize must be specified in concurrent situations. since expansion has no concurrency control.
- See Also:
DenseVertexSet
-
-
Constructor Summary
Constructors Constructor Description VertexSet(int start, int end)
VertexSet(long start, long end)
VertexSet(VertexRange<Long> vertices)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
assign(VertexSet other)
Set this vertex set with bits from another.void
clear()
Erase current status.long
count()
boolean
empty()
boolean
exist(int vid)
boolean
get(int vid)
boolean
get(long vid)
boolean
get(Vertex<Long> vertex)
Bitset
getBitSet()
long
getLeft()
long
getRight()
void
insert(Vertex<Long> vertex)
boolean
partialEmpty(int l, int r)
Check whether all [l, r) values are false;void
set(int vid)
void
set(long vid)
void
set(Vertex<Long> vertex)
This function is not thread safe, even you are assigning threads with segmented partition.void
set(Vertex<Long> vertex, boolean newValue)
Bind a vertex with a new vertex data.
-
-
-
Constructor Detail
-
VertexSet
public VertexSet(int start, int end)
-
VertexSet
public VertexSet(long start, long end)
-
VertexSet
public VertexSet(VertexRange<Long> vertices)
-
-
Method Detail
-
count
public long count()
-
getLeft
public long getLeft()
-
getRight
public long getRight()
-
getBitSet
public Bitset getBitSet()
-
exist
public boolean exist(int vid)
-
get
public boolean get(int vid)
-
get
public boolean get(long vid)
-
set
public void set(int vid)
-
set
public void set(Vertex<Long> vertex)
This function is not thread safe, even you are assigning threads with segmented partition. Because javaBitset
init thewordinUse = 0
and adaptively increases it,ensureCapacity
is to be invoked, causing problem. So we access the highest bit in initializing.- Parameters:
vertex
- input vertex.
-
set
public void set(Vertex<Long> vertex, boolean newValue)
Bind a vertex with a new vertex data.- Parameters:
vertex
- querying vertex.newValue
- value to be bound to querying vertex.
-
set
public void set(long vid)
-
empty
public boolean empty()
-
partialEmpty
public boolean partialEmpty(int l, int r)
Check whether all [l, r) values are false;- Parameters:
l
- left boundary.r
- right boundary.- Returns:
- empty in this range or not.
-
clear
public void clear()
Erase current status.
-
assign
public void assign(VertexSet other)
Set this vertex set with bits from another.- Parameters:
other
- Another vertex set
-
-