Class VertexSet


  • public class VertexSet
    extends Object
    VertexSet Uses BitSet as underlying data structure to mark the presence of a vertex. It provides interfaces which works along with Vertex and VertexRange. 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 Detail

      • VertexSet

        public VertexSet​(int start,
                         int end)
      • VertexSet

        public VertexSet​(long start,
                         long end)
    • 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​(Vertex<Long> vertex)
      • 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 java Bitset init the wordinUse = 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.
      • insert

        public void insert​(Vertex<Long> vertex)
      • 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