Package oracle.pgx.api
Class Partition<ID>
- java.lang.Object
-
- oracle.pgx.api.internal.ApiObject
-
- oracle.pgx.api.Destroyable
-
- oracle.pgx.api.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 Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PgxFuture<java.lang.Void>destroyAsync()Requests destruction of this object.VertexProperty<ID,java.lang.Long>getComponentsProperty()Returns the property that contains for each vertex, its associated component IDPgxGraphgetGraph()Gets the graph.VertexCollection<ID>getPartitionByIndex(long index)Gets a partition by index.VertexCollection<ID>getPartitionByVertex(PgxVertex<ID> vertex)Gets the partition a particular vertex belongs to.longgetPartitionIndexOfVertex(PgxVertex<ID> vertex)Gets the index of the partition a particular vertex belongs to.java.util.Iterator<VertexCollection<ID>>iterator()Creates an iterator over all partitions.longsize()Gets the size of this partition.java.lang.StringtoString()-
Methods inherited from class oracle.pgx.api.Destroyable
close, destroy
-
-
-
-
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:
iteratorin interfacejava.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 andsize()- 1.- Returns:
- the set of vertices representing the partition.
-
destroyAsync
public PgxFuture<java.lang.Void> destroyAsync()
Description copied from class:DestroyableRequests destruction of this object. After this method returns, the behavior of any method of this class becomes undefined.- Specified by:
destroyAsyncin classDestroyable- Returns:
- a future which will be completed once the destruction request finishes.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-