HI Andrey.
So you have following options:
1. we have shortestPath function to find short path.
2. You can use traverse, it start from link which you provided and go
through all links are present in doucuments.
3. You can use Gremlin,  better you Groovy fur such task, like this one :
a.out('KNOWS').loop(1){it.loops<100}{true}.has('name', 'B').path{it.name}

Your mistake is that you work with gremlin query on client side.
I mean you should create select with gremlin query pass it on server side
and then see the result, otherwise you will always need to retrieve data
from remote connect to the client to process request.


On Mon, Mar 24, 2014 at 9:15 PM, Andrey Yesyev <[email protected]>wrote:

> Hi there,
>
> I've come to the most interesting part of my project - traversing graph.
>
> Now I'm investigating how I can find
>
> 1. All paths between 2 vertices
> 2. Shortest path between 2 vertices. If I can solve the first problem,
> this won't be an issue.
> 3. Get related vertices to vertex V with given depth D of relationship.
>
> I've come across with SELECT .. TRAVERSE query. But it's still unclear for
> me, how it works in general.
> And how I can find all paths using this query in particular.
>
> Also, I'm looking in using Gremlin for these problems.
> I came up with this piece of code
>
>         OrientGraph graph =
> DatabaseManager.getInstance().getDatabase("remote:192.168.200.1/ePersona
> ").getConnection();
>         final Vertex v = graph.getVertex("#21:14");
>         GremlinPipeline pipe = new
> GremlinPipeline(graph.getVertex("#21:7")).as("person");
>         List path = pipe.both("RELATED").loop("person", new
> PipeFunction<LoopPipe.LoopBundle, Boolean>() {
>             @Override
>             public Boolean compute(LoopPipe.LoopBundle loopBundle) {
>                 return loopBundle.getLoops() <5 &&
> !((Vertex)loopBundle.getObject()).getId().toString().equals("#21:14") ;
>             }
>         }).path().toList();
>
> Trying to find all paths between vertices #21:14 and #21:7. I've got 3634
> of vertices and 12572 edges in my DB, this query has been working for 15
> minutes for now and I don't think it'll be done any time soon.
>
> This means I'm stuck again.
>
> Any comments, suggestions are very welcome!
>
> -Andrey
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "OrientDB" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Best regards,
Andrey Lomakin.

Orient Technologies
the Company behind OrientDB

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to