On Sun, Sep 11, 2011 at 9:26 AM, espeed <[email protected]> wrote:

> Hi Xavier -
>
> If you would, provide a more detailed description of what the query is
> trying to do.
>
We have a primary node type, which has outbound connections to secondary
node types.
A primary node will never have a direct connection to another primary node,
but it can be "related" if they both have an outbound connection to the same
secondary node.

This query is pulling out all "related" edges to a given depth, and
returning those so that the graph can be visualized. As well as the edges,
for the visualization I also need properties stored on the nodes (they have
different types, for instance).


>
> You might look at the Gremlin aggregate, scatter, and gather methods, and I
> thought there was a collect() method, but I don't see it in the docs --
> Marko, isn't/wasn't that method?).
>
I couldn't from the docs figure out how to apply these methods to my
problem. I tried a few variations but nothing that behaved as I needed.


> Here are some docs that might be useful:
>
> Gremlin: Depth First vs. Breadth First
>   https://github.com/tinkerpop/gremlin/wiki/Depth-First-vs.-Breadth-First
>
> [Gremlin] The Generalize AsPipe model - back(), loop(), and table()
>   https://groups.google.com/d/topic/gremlin-users/5ujhy2bMKMI/discussion

loop() makes sense to me, the above code avoids it for performance reasons.
I played around with table quite a bit (reading both the wiki and Neo4j Rest
docs, including the one Peter linked) but couldn't make it "fit" into what I
want to do.

If it was possible to create a table outside of a pipe (where I am doing
t.collect in my code), I think that would be helpful, but I couldn't figure
out the API (I couldn't even find Table in the Gremlin source code ... where
is it?).

And to make things cleaner, you can also create user-define steps:
>  https://github.com/tinkerpop/gremlin/wiki/User-Defined-Steps.
>
> For example, here's a user-defined step that builds a tree:
>    https://gist.github.com/1197179

I didn't know about these, will investigate.

Thanks everyone,
Xavier
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to