嵌入式图形数据库:Graphlite
jopen
10年前
类似 FlockDB
的嵌入式图形数据库, 存储 邻接表类. 你可以在查询中进行遍历(图形走查), 并配合传统数据库使用,比如, SQLite。
from graphlite import connect, V graph = connect(':memory:', graphs=['knows']) with graph.transaction() as tr: for i in range(2, 5): tr.store(V(1).knows(i)) tr.store(V(2).knows(3)) tr.store(V(3).knows(5)) # who are the friends of the mutual friends # of both 1 and 2? graph.find(V(1).knows)\ .intersection(V(2).knows)\ .traverse(V().knows)