Yes I am creating a general graph with only one edge definition. below is the setup.js for that
// load modules
var graph_module = require("org/arangodb/general-graph");
// create graph if does not already exists
var graph = null;
if(!graph_module._exists("sampleGraph")) {
var containsXRelation = graph_module._directedRelation("containsX", ["X"], ["X"]);
var edgeDefinitions = graph_module._edgeDefinitions(containsXRelation);
graph = graph_module._create("sampleGraph", edgeDefinitions);
}
else {
graph = graph_module._graph("sampleGraph");
}
them some more stuff like creating index's ...
Also, I have some graph related code outside the controller actions
var sampleGraph = graph_module._graph("sampleGraph");
var vertex = contactSpaceGraph._getVertexCollectionByName("contactX");
var edge = contactSpaceGraph._getEdgeCollectionByName("X");
I did this outside of the actions because I do not want to create them again and again. should I move them inside of every controller actions.
Thanks,
Vikas