Python implementation of the tinygraphio graph data interchange file format.
Install with poetry
poetry add tinygraphio
Install with pip
pip install tinygraphio
Tinygraph
implements a compressed sparse row graphTinygraphioReader
implements reading a graph from a binary file-like objectTinygraphioWriter
implements writing a graph to a binary file-like object
from tinygraphio.graph import Tinygraph, Node, Edge
from tinygraphio.reader import TinygraphioReader
from tinygraphio.writer import TinygraphioWriter
Writing
graph = Tinygraph(offsets=[0, 2, 4, 5], targets=[1, 2, 0, 2, 1])
with open("berlin.tinygraph", "wb") as f:
writer = TinygraphioWriter(f)
writer.write(graph)
Reading
with open("berlin.tinygraph", "rb") as f:
reader = TinygraphioReader(f)
graph = reader.read()
Note: this library implements reading and writing a compressed sparse row graph effectively and efficiently and sharing it in a portable way. We do not provide a full-blown graph computation toolkit on purpose.
Copyright © 2023 tinygraph
Distributed under the MIT License (MIT).