Package com.alibaba.graphscope.ds
Class VertexSet
- java.lang.Object
-
- com.alibaba.graphscope.ds.VertexSet
-
public class VertexSet extends Object
VertexSet UsesBitSetas underlying data structure to mark the presence of a vertex. It provides interfaces which works along withVertexandVertexRange. 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 voidassign(VertexSet other)Set this vertex set with bits from another.voidclear()Erase current status.longcount()booleanempty()booleanexist(int vid)booleanget(int vid)booleanget(long vid)booleanget(Vertex<Long> vertex)BitsetgetBitSet()longgetLeft()longgetRight()voidinsert(Vertex<Long> vertex)booleanpartialEmpty(int l, int r)Check whether all [l, r) values are false;voidset(int vid)voidset(long vid)voidset(Vertex<Long> vertex)This function is not thread safe, even you are assigning threads with segmented partition.voidset(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 javaBitsetinit thewordinUse = 0and adaptively increases it,ensureCapacityis 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
-
-