-
Notifications
You must be signed in to change notification settings - Fork 72
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
Need more clarifications over traverse function #25
Comments
Hi afidegnum, For those arguments you must pass in javascript functions with pre-determined signatures that you must abide by. The functions allow you to customize the traversal behaviour. Python-arango is built right on top of ArangoDB's REST API, whose documenation will probably give you more information. If you look at the link you will notice that the parameter names have changed slightly: init_func --> init Here are some examples from it: init_func="result.visited = 0; result.myVertices = [ ];"
visitor_func="result.visited.vertices.push(vertex._id);"
expander_func="var connections = [ ];if (vertex.name === \"Alice\") {config.datasource.getInEdges(vertex).forEach(function (e) {connections.push({ vertex: require(\"internal\").db._document(e._from), edge: e});});}if (vertex.name === \"Eve\") {config.datasource.getOutEdges(vertex).forEach(function (e) {connections.push({vertex: require(\"internal\").db._document(e._to), edge: e});});}return connections;"
filter_func="if (vertex.name === \"Bob\" || vertex.name === \"Charlie\") { return \"exclude\";}return;" Unfortunately the page doesn't seem to contain an example for sort_func. Due to the limitation of ArangoDB's REST API, there is no easy way to translate these capabilities to be more Pythonic, which is why I left the parameters as they are to take pure javascript strings. Let me know if you have anymore questions. Thanks, |
what's the purpose of each functions? i m still finding hard to undersand, |
Hi Alexandropov, Have you checked out the documentation? It explains what each function does to some extent. You may not need these functions at all, however. What are you trying to achieve exactly? could you give me an example with edges + vertices and how you want to traverse them in detail? Thanks, |
Closing this out since I haven't heard back from you for a while now. Let me know if you have any other questions! |
on arango.graph.Graph,
can you please explain the following and give examples of the following functions:
init_func
sort_func
visitor_func
expander_func
filter_function
i m still having difficulties traversing the graphs, when i added contents to the child graphs, the whole traversal system changed.
The text was updated successfully, but these errors were encountered: