Class Partition<ID>

  • Type Parameters:
    ID - the ID type of the vertices
    All Implemented Interfaces:
    java.lang.AutoCloseable, java.lang.Iterable<VertexCollection<ID>>

    public class Partition<ID>
    extends Destroyable
    implements java.lang.Iterable<VertexCollection<ID>>
    A vertex partition of a graph. Each partition is a set of vertices.
    • Method Detail

      • getGraph

        public PgxGraph getGraph()
        Gets the graph.
        Returns:
        the graph this partition belongs to
      • getComponentsProperty

        public VertexProperty<ID,​java.lang.Long> getComponentsProperty()
        Returns the property that contains for each vertex, its associated component ID
        Returns:
        the property that contains the components IDs
      • size

        public long size()
        Gets the size of this partition.
        Returns:
        the number of partitions.
      • iterator

        public java.util.Iterator<VertexCollection<ID>> iterator()
        Creates an iterator over all partitions.
        Specified by:
        iterator in interface java.lang.Iterable<ID>
        Returns:
        the iterator.
      • getPartitionByVertex

        public VertexCollection<ID> getPartitionByVertex​(PgxVertex<ID> vertex)
        Gets the partition a particular vertex belongs to.
        Parameters:
        vertex - the vertex
        Returns:
        the set of vertices representing the partition the given vertex belongs to.
      • getPartitionIndexOfVertex

        public long getPartitionIndexOfVertex​(PgxVertex<ID> vertex)
        Gets the index of the partition a particular vertex belongs to.
        Parameters:
        vertex - the vertex
        Returns:
        the index of the partition the given vertex belongs to, a number between 0 and size() - 1.
      • getPartitionByIndex

        public VertexCollection<ID> getPartitionByIndex​(long index)
        Gets a partition by index.
        Parameters:
        index - the index. Must be between 0 and size() - 1.
        Returns:
        the set of vertices representing the partition.
      • destroyAsync

        public PgxFuture<java.lang.Void> destroyAsync()
        Description copied from class: Destroyable
        Requests destruction of this object. After this method returns, the behavior of any method of this class becomes undefined.
        Specified by:
        destroyAsync in class Destroyable
        Returns:
        a future which will be completed once the destruction request finishes.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object