Database Reference
In-Depth Information
private static final String MOVIE_DB = "$NEO4J_HOME/data/
graph.db";
private GraphDatabaseService graphDb;
public static void main(String[] args) {
Traversals movies = new Traversals();
movies.startTraversing();
}
private void startTraversing() {
// Initialize Graph Database
graphDb = new
GraphDatabaseFactory().newEmbeddedDatabase(MOVIE_DB);
// Start a Transaction
try (Transaction tx = graphDb.beginTx()) {
// get the Traversal Descriptor from instance of
GGraph DB
TraversalDescription trvDesc =
graphDb.traversalDescription();
// Defining Traversals need to use Depth First
Approach
trvDesc = trvDesc.depthFirst();
// Instructing to exclude the Start Position and
include all others
// while Traversing
trvDesc =
trvDesc.evaluator(Evaluators.excludeStartPosition());
// Defines the depth of the Traversals. Higher the
Integer, more
// deep would be traversals.
// Default value would be to traverse complete Tree
trvDesc = trvDesc.evaluator(Evaluators.toDepth(3));
// Get a Traverser from Descriptor
Traverser traverser =
Search WWH ::




Custom Search