3

I read about graphs in How to store documents in an ArangoDb graph using ArangoJs?

Now I have the following use case: I have a backend using ArangoDb and have 2 ordinary collections for USER and LOCATION. Now I want to implement a "rating" of a location from a users perspective.

So I thought it would be a good idea to design this via graphs. As far as I understand I have to create a graph and use an edge collection to save it.

What I don't understand is the difference between ordinary collections and vertex collections. Of course I would like to have the graph "managed" -> means when I remove the location or the user also the "edge" should be removed.

How can I achieve this based on my current infrastructure. (in the referenced stackoverflow question the example is using already "vertex" collections)

TIA

maku_at
  • 1,191
  • 2
  • 10
  • 17

1 Answers1

4

There is no difference between a vertex collection and a normal collection. It is called a vertex collection when the collection is part of a graph and a normal collection when it is not.

In the reference question you provided the poster shows two examples of creating the users collection. You can either use the normal api and create a normal collection or you can use the graph API and make the collection a part of the graph.

Structurally they are the same. The difference is whether they are a part of a graph (vertex) or not (normal).

Jerry Saravia
  • 3,508
  • 3
  • 21
  • 36
  • Thanks for your answer: to clarify it -> when I have the two existing collections ("locations" and "users") and also existing "documents" in these collections.Now I create a graph and save the the the edge via an edgeCollection (with the id's from an already existing user document to an already existing location document) -> this would lead to a managed graph? – maku_at Aug 30 '17 at 09:04
  • 1
    If you create a graph definition via the Web UI or via arangosh using the `general-graph` module with your vertex and edge collections, then you can call that graph a managed graph. In graph traversals, you refer to it like `FOR v IN OUTBOUND start GRAPH "graphName"`. Use the `general-graph` module for manipulations, especially removal of vertices to ensure graph consistency (no dangling edges). – CodeManX Aug 31 '17 at 13:29