Package oracle.pgx.algorithm
Interface VertexSet
-
- All Superinterfaces:
java.lang.Cloneable
public interface VertexSet extends java.lang.Cloneable
An unordered set of vertices (no duplicates).
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
add(PgxVertex v)
Add the vertex to the set.boolean
allMatch(java.util.function.Predicate<PgxVertex> predicate)
Check if the predicate holds for all vertices in the set.boolean
anyMatch(java.util.function.Predicate<PgxVertex> predicate)
Check if the predicate holds for any vertex in the set.<T extends java.lang.Number>
Tavg(java.util.function.Function<PgxVertex,T> reducer)
Apply the reducer to each vertex in the set and compute the average.void
clear()
Remove all vertices from the set.default VertexSet
clone()
Clone this vertex set.boolean
contains(PgxVertex v)
Check if the set contains the given vertex.static VertexSet
create()
Instantiate a new vertex set.VertexSet
filter(java.util.function.Predicate<PgxVertex> predicate)
Filter the vertices in the set by the given predicate.VertexSet
filter(VertexProperty<java.lang.Boolean> property)
Filter the vertices in the set by the given boolean property.void
forEach(java.util.function.Consumer<PgxVertex> callable)
Run the callable for each vertex in the set in parallel.void
forSequential(java.util.function.Consumer<PgxVertex> callable)
Run the callable for each vertex in the set in sequence.<T extends java.lang.Number>
Tmax(java.util.function.Function<PgxVertex,T> reducer)
Apply the reducer to each vertex in the set and compute the maximum.VertexSet
orderBy(java.util.function.Function<PgxVertex,java.lang.Number> transform, Order order)
Order the vertices in the set based on the result of the transformation function.VertexSet
orderBy(VertexProperty vertexProperty, Order order)
Order the vertices based on the value of the property.void
remove(PgxVertex v)
Remove the vertex from the set.long
size()
Get the number of vertices in the set.<T extends java.lang.Number>
Tsum(java.util.function.Function<PgxVertex,T> reducer)
Apply the reducer to each vertex in the set and sum the results.<T extends java.lang.Number>
Tsum(VertexProperty<T> reducer)
Get the property for each vertex in the set and sum the results.
-
-
-
Method Detail
-
create
static VertexSet create()
Instantiate a new vertex set.- Returns:
-
orderBy
VertexSet orderBy(VertexProperty vertexProperty, Order order)
Order the vertices based on the value of the property.- Parameters:
vertexProperty
-order
-- Returns:
-
orderBy
VertexSet orderBy(java.util.function.Function<PgxVertex,java.lang.Number> transform, Order order)
Order the vertices in the set based on the result of the transformation function.- Parameters:
transform
-order
-- Returns:
-
filter
VertexSet filter(java.util.function.Predicate<PgxVertex> predicate)
Filter the vertices in the set by the given predicate.- Parameters:
predicate
-- Returns:
-
filter
VertexSet filter(VertexProperty<java.lang.Boolean> property)
Filter the vertices in the set by the given boolean property.- Parameters:
property
-- Returns:
-
forEach
void forEach(java.util.function.Consumer<PgxVertex> callable)
Run the callable for each vertex in the set in parallel.- Parameters:
callable
-
-
forSequential
void forSequential(java.util.function.Consumer<PgxVertex> callable)
Run the callable for each vertex in the set in sequence.- Parameters:
callable
-
-
add
void add(PgxVertex v)
Add the vertex to the set.- Parameters:
v
-
-
remove
void remove(PgxVertex v)
Remove the vertex from the set.- Parameters:
v
-
-
size
long size()
Get the number of vertices in the set.- Returns:
-
contains
boolean contains(PgxVertex v)
Check if the set contains the given vertex.- Parameters:
v
-- Returns:
-
sum
<T extends java.lang.Number> T sum(java.util.function.Function<PgxVertex,T> reducer)
Apply the reducer to each vertex in the set and sum the results.- Type Parameters:
T
-- Parameters:
reducer
-- Returns:
-
sum
<T extends java.lang.Number> T sum(VertexProperty<T> reducer)
Get the property for each vertex in the set and sum the results.- Type Parameters:
T
-- Parameters:
reducer
-- Returns:
-
max
<T extends java.lang.Number> T max(java.util.function.Function<PgxVertex,T> reducer)
Apply the reducer to each vertex in the set and compute the maximum.- Type Parameters:
T
-- Parameters:
reducer
-- Returns:
-
avg
<T extends java.lang.Number> T avg(java.util.function.Function<PgxVertex,T> reducer)
Apply the reducer to each vertex in the set and compute the average.- Type Parameters:
T
-- Parameters:
reducer
-- Returns:
-
anyMatch
boolean anyMatch(java.util.function.Predicate<PgxVertex> predicate)
Check if the predicate holds for any vertex in the set.- Parameters:
predicate
-- Returns:
-
allMatch
boolean allMatch(java.util.function.Predicate<PgxVertex> predicate)
Check if the predicate holds for all vertices in the set.- Parameters:
predicate
-- Returns:
-
clear
void clear()
Remove all vertices from the set.
-
clone
default VertexSet clone()
Clone this vertex set.- Returns:
-
-