Graph-algo example

Path finding example

Calculating the shortest path (least number of relationships) between two nodes. Let's say we want to calculate the shortest path from Neo to Agent Smith. This is how to do it:

        PathFinder<Path> finder = GraphAlgoFactory.shortestPath(
                Traversal.expanderForTypes( KNOWS, Direction.BOTH ), 4 );
        Path foundPath = finder.findSinglePath( neo, agentSmith );
        System.out.println( "Path from Neo to Agent Smith: "
                            + Traversal.simplePathToString( foundPath, NAME_KEY ) );

Full source code: CalculateShortestPath