Here I'm trying to create graph database whose structure will look following. As I keep adding more nodes, I don't see the depth of the tree increasing
. Can one suggest what I might be doing wrong here?
A:1
/ \
B:2 C:3
/ \
D:4 E:5
>>> import lmdb
>>> env = lmdb.open("treedb.lmdb")
>>> txn = env.begin(write = True)
>>> txn.stat()
{'psize': 4096, 'depth': 0, 'branch_pages': 0, 'leaf_pages': 0, 'overflow_pages': 0, 'entries': 0}
>>> txn.put('root'.encode('utf-8'),json.dumps({'A':1}).encode('utf-8'))
True
>>> txn.stat()
{'psize': 4096, 'depth': 1, 'branch_pages': 0, 'leaf_pages': 1, 'overflow_pages': 0, 'entries': 1}
>>> txn.put('A'.encode('utf-8'), json.dumps({'A':{'B':2}}).encode('utf-8'))
True
>>> txn.stat()
{'psize': 4096, 'depth': 1, 'branch_pages': 0, 'leaf_pages': 1, 'overflow_pages': 0, 'entries': 2}
>>>
>>> txn.put('A'.encode('utf-8'), json.dumps({'A':{'C':3}}).encode('utf-8'))
True
>>>
>>> txn.stat()
{'psize': 4096, 'depth': 1, 'branch_pages': 0, 'leaf_pages': 1, 'overflow_pages': 0, 'entries': 3}
>>>
>>> txn.put('B'.encode('utf-8'), json.dumps({'B':{'D':4}}).encode('utf-8'))
True
>>> txn.put('C'.encode('utf-8'), json.dumps({'C':{'E':5}}).encode('utf-8'))
>>> txn.stat()
{'psize': 4096, 'depth': 1, 'branch_pages': 0, 'leaf_pages': 1, 'overflow_pages': 0, 'entries': 5}