Graph

class nx_arangodb.classes.dict.graph.GraphDict(db: StandardDatabase, graph: Graph, *args: Any, **kwargs: Any)[source]

A dictionary-like object for storing graph attributes.

Given that ArangoDB does not have a concept of graph attributes, this class stores the attributes in a collection with the graph name as the document key.

The default collection is called _graphs. However, if the DATABASE_GRAPH_COLLECTION environment variable is specified, then that collection will be used. This variable is useful when the database user does not have permission to access the _graphs system collection.

Parameters

dbarango.database.StandardDatabase

The ArangoDB database.

grapharango.graph.Graph

The ArangoDB graph.

Example

>>> G = nxadb.Graph(name='MyGraph', foo='bar')
>>> G.graph['foo']
'bar'
>>> G.graph['foo'] = 'baz'
>>> del G.graph['foo']
class nx_arangodb.classes.dict.graph.GraphAttrDict(db: StandardDatabase, graph: Graph, graph_id: str, *args: Any, **kwargs: Any)[source]

The inner-level of the dict of dict structure representing the attributes of a graph stored in the database.

Only used if the value associated with a GraphDict key is a dict.

Parameters

dbarango.database.StandardDatabase

The ArangoDB database.

grapharango.graph.Graph

The ArangoDB graph.

graph_idstr

The ArangoDB document ID of the graph.

Example

>>> G = nxadb.Graph(name='MyGraph', foo={'bar': 'baz'})
>>> G.graph['foo']['bar']
'baz'
>>> G.graph['foo']['bar'] = 'qux'