Search code examples
pythonarangodbpyarango

Python - How to create edges in ArangoDB


I am using pyArango to handle by database operations. I have already created a graph and now I want add an edge in the graph.

So what are the methods from pyArango suitable for performing the mentioned task


Solution

  • You can either use the link() function of a graph:

    http://bioinfo.iric.ca/~daoudat/pyArango/graph.html#pyArango.graph.Graph.link

    edge = g.link("myEdgesCollection", doc1, doc2, {})
    

    or the links()/save() function of an edge document: http://bioinfo.iric.ca/~daoudat/pyArango/document.html#pyArango.document.Edge.links

    edge.links(doc1, doc2)