General Graphs
This chapter describes the general-graph module. It allows you to define a graph that is spread across several edge and document collections. This allows you to structure your models in line with your domain and group them logically in collections giving you the power to query them in the same graph queries. There is no need to include the referenced collections within the query, this module will handle it for you.
New to ArangoDB? Take the free ArangoDB Graph Course for freshers.
Three Steps to create a graph
Create a graph
arangosh> var graph_module = require("@arangodb/general-graph");
arangosh> var graph = graph_module._create("myGraph");
arangosh> graph;
{[GeneralGraph] }
Add some vertex collections
arangosh> graph._addVertexCollection("shop");
arangosh> graph._addVertexCollection("customer");
arangosh> graph._addVertexCollection("pet");
arangosh> graph = graph_module._graph("myGraph");
{[GeneralGraph]
"customer" : [ArangoCollection 74995, "customer" (type document, status loaded)],
"pet" : [ArangoCollection 75004, "pet" (type document, status loaded)],
"shop" : [ArangoCollection 74986, "shop" (type document, status loaded)]
}
Define relations on the Graph