def createGraph(self, name, createCollections = True, isSmart = False, numberOfShards = None, smartGraphAttribute = None) :
        """Creates a graph and returns it. 'name' must be the name of a class inheriting from Graph.
        Checks will be performed to make sure that every collection mentionned in the edges definition exist. Raises a ValueError in case of
        a non-existing collection."""

        def _checkCollectionList(lst) :
            for colName in lst :
                if not COL.isCollection(colName) :
                    raise ValueError("'%s' is not a defined Collection" % colName)

        graphClass = GR.getGraphClass(name)

        ed = []
        for e in graphClass._edgeDefinitions :
            if not COL.isEdgeCollection(e.edgesCollection) :
                raise ValueError("'%s' is not a defined Edge Collection" % e.edgesCollection)
            _checkCollectionList(e.fromCollections)
            _checkCollectionList(e.toCollections)

            ed.append(e.toJson())

        _checkCollectionList(graphClass._orphanedCollections)

        options = {}
        if numberOfShards:
            options['numberOfShards'] = numberOfShards
        if smartGraphAttribute:
            options['smartGraphAttribute'] = smartGraphAttribute

        payload = {
                "name": name,
                "edgeDefinitions": ed,
                "orphanCollections": graphClass._orphanedCollections
            }

        if isSmart :
                payload['isSmart'] = isSmart

        if options:
            payload['options'] = options

        payload = json.dumps(payload)

        r = self.connection.session.post(self.graphsURL, data = payload)
        data = r.json()

        if r.status_code == 201 or r.status_code == 202 :
            self.graphs[name] = graphClass(self, data["graph"])
        else :
            raise CreationError(data["errorMessage"], data)
        return self.graphs[name]
def createGraph ( self , name , createCollections = True , isSmart = False , numberOfShards = None , smartGraphAttribute = None ) : def _checkCollectionList ( lst ) : for colName in lst : if not COL . isCollection ( colName ) : raise ValueError ( "'%s' is not a defined Collection" % colName ) graphClass = GR . getGraphClass ( name ) ed = [ ] for e in graphClass . _edgeDefinitions : if not COL . isEdgeCollection ( e . edgesCollection ) : raise ValueError ( "'%s' is not a defined Edge Collection" % e . edgesCollection ) _checkCollectionList ( e . fromCollections ) _checkCollectionList ( e . toCollections ) ed . append ( e . toJson ( ) ) _checkCollectionList ( graphClass . _orphanedCollections ) options = { } if numberOfShards : options [ 'numberOfShards' ] = numberOfShards if smartGraphAttribute : options [ 'smartGraphAttribute' ] = smartGraphAttribute payload = { "name" : name , "edgeDefinitions" : ed , "orphanCollections" : graphClass . _orphanedCollections } if isSmart : payload [ 'isSmart' ] = isSmart if options : payload [ 'options' ] = options payload = json . dumps ( payload ) r = self . connection . session . post ( self . graphsURL , data = payload ) data = r . json ( ) if r . status_code == 201 or r . status_code == 202 : self . graphs [ name ] = graphClass ( self , data [ "graph" ] ) else : raise CreationError ( data [ "errorMessage" ] , data ) return self . graphs [ name ]
Creates a graph and returns it. 'name' must be the name of a class inheriting from Graph.
        Checks will be performed to make sure that every collection mentionned in the edges definition exist. Raises a ValueError in case of
        a non-existing collection.