Package oracle.pgx.algorithm
Interface Traversal
-
public interface Traversal
Utility functions to build a BFS/DFS traversal.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Traversal.Direction
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description Traversal
backward(java.util.function.Consumer<PgxVertex> backward)
Visit the vertex in the backward direction of the traversal.Traversal
backwardFilter(java.util.function.Predicate<PgxVertex> filter)
Filter the vertices in the BFS/DFS traversal when going backward.static int
currentLevel()
Get the current level of the BFS/DFS traversal.Traversal
direction(Traversal.Direction direction)
Set the direction of the BFS/DFS traversal.Traversal
filter(java.util.function.Predicate<PgxVertex> filter)
Filter the vertices in the BFS/DFS traversal.Traversal
forward(java.util.function.Consumer<PgxVertex> forward)
Visit the vertex in the forward direction of the BFS traversal.static Traversal
inBFS(PgxGraph graph, PgxVertex root)
Create a BFS traversal in the given graph rooted at the given vertex.static Traversal
inDFS(PgxGraph graph, PgxVertex root)
Create a DFS traversal in the given graph rooted at the given vertex.Traversal
navigator(java.util.function.Predicate<PgxVertex> navigator)
If the navigator is false, do not consider the neighbors of this vertex in the traversal.static void
stopTraversal()
Abort the current traversal.
-
-
-
Method Detail
-
inBFS
static Traversal inBFS(PgxGraph graph, PgxVertex root)
Create a BFS traversal in the given graph rooted at the given vertex.- Parameters:
graph
-root
-- Returns:
-
inDFS
static Traversal inDFS(PgxGraph graph, PgxVertex root)
Create a DFS traversal in the given graph rooted at the given vertex.- Parameters:
graph
-root
-- Returns:
-
currentLevel
static int currentLevel()
Get the current level of the BFS/DFS traversal.- Returns:
-
stopTraversal
static void stopTraversal()
Abort the current traversal.
-
filter
Traversal filter(java.util.function.Predicate<PgxVertex> filter)
Filter the vertices in the BFS/DFS traversal.- Parameters:
filter
-- Returns:
-
navigator
Traversal navigator(java.util.function.Predicate<PgxVertex> navigator)
If the navigator is false, do not consider the neighbors of this vertex in the traversal.- Parameters:
navigator
-- Returns:
-
forward
Traversal forward(java.util.function.Consumer<PgxVertex> forward)
Visit the vertex in the forward direction of the BFS traversal.- Parameters:
forward
-- Returns:
-
backwardFilter
Traversal backwardFilter(java.util.function.Predicate<PgxVertex> filter)
Filter the vertices in the BFS/DFS traversal when going backward.- Parameters:
filter
-- Returns:
-
backward
Traversal backward(java.util.function.Consumer<PgxVertex> backward)
Visit the vertex in the backward direction of the traversal.- Parameters:
backward
-- Returns:
-
direction
Traversal direction(Traversal.Direction direction)
Set the direction of the BFS/DFS traversal.- Parameters:
direction
-- Returns:
-
-