嵌入式圖形數據庫:Graphlite
類似 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)
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!