Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: What do i do to return a subtree #201

Open
eosfor opened this issue May 14, 2018 · 2 comments
Open

Question: What do i do to return a subtree #201

eosfor opened this issue May 14, 2018 · 2 comments

Comments

@eosfor
Copy link

eosfor commented May 14, 2018

Hello colleagues, lets say i had a graph and i want to return a subtree of a node.

For example query may look like this.

"MAG
            .StartFrom($($g.CellId))
            .FollowEdge(`"OutEdge`")
            .VisitNode(_ => Action.Continue & Action.Return)
            .FollowEdge(`"OutEdge`")
            .VisitNode(_ => Action.Continue & Action.Return)"

The example above, as i understand, returns only two child nodes. However i don't know the depth of a subtree. It could be a single node or no children at all, or it could be tens of sub-nodes with their sub-nodes. Is there any sample query to extract a sub-tree?

Thanks

@yatli
Copy link
Contributor

yatli commented May 20, 2018

well @eosfor for such queries you'll have to use a bounded closure. Yeah it looks like the sample query, just extend the number of hops to what is suitable for you.

Doing unbounded closure is usually a bad idea.

@eosfor
Copy link
Author

eosfor commented May 21, 2018

Thanks @yatli, maybe i misunderstood something in your answer. Let me clarify the ask. Actually i was talking about a way of representing Depth-first search(DFS) algorithm trough LIKQ query, so to speak. The idea is to traverse the graph to the full depth starting from some node. Is it possible with LIKQ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants