Comments (4)
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
sort_func --> sort
visitor_func --> visitor
expander_func --> expander
filter_func --> filter
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,
Joohwan
from python-arango.
what's the purpose of each functions? i m still finding hard to undersand,
how do i traverse predefined graph paths in python?
from python-arango.
Hi Alexandropov,
Have you checked out the documentation? It explains what each function does to some extent.
If you still have unresolved questions you will have to direct them to ArangoDB team. Python-arango is simply a driver that pipes all the inputs to ArangoDB's REST API, and I'm afraid my knowledge on the internals is rather limited.
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,
Joohwan
from python-arango.
Closing this out since I haven't heard back from you for a while now. Let me know if you have any other questions!
from python-arango.
Related Issues (20)
- Documentation issue: ordered/geoJSON on collection.add_geo_index HOT 1
- Authenticate using User JWT-Token HOT 1
- Custom JSON serializer not being used for bulk operations HOT 3
- Edges not retrievable without committing transaction HOT 2
- python-arango is not working without pip-install installation HOT 3
- Content in API docs of branch `main` disappeared HOT 1
- merge functionality HOT 1
- Replacement for `pkg_resources` HOT 1
- Transactions Failing on Collection Deletion HOT 3
- Unable to disable request timeout HOT 2
- Requests with endpoint="/_api/simple/..." fail HOT 10
- API Specification Page is not rendering
- Collection.find does not work in 7.6.1 if filter attribute is set to none HOT 3
- Enum can't be serialized anymore after upgrade to 7.6.2 HOT 2
- bind_vars type hints are incomplete HOT 4
- broken build_filter_conditions for keys with spaces // backtick escaping missing? HOT 2
- Unix socket support HOT 5
- Make ArangoClient generic to support typing when a custom serialiser is used HOT 9
- feature request: Continue an existing transaction HOT 3
- `arango.exceptions.GraphTraverseError: [HTTP 404][ERR 404] unknown path '/_api/traversal'` when using `traverse` (arangodb 3.12) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-arango.