TinyGraph¶
A small library for small graphs
version 1.0.2.
TinyGraph is a open source Python library for small, weighted, undirected graphs with no self-loops. TG supports vertex properties, edge properties, and edge weights by default. Behind the scenes data is stored as NumPy arrays to make it easy to write fast graph algorithms with Numba and Cython. We interoperate closely with other graph libraries, especially NetworkX, to avoid reimplementing the wheel.
TinyGraph is simple to use¶
import tinygraph as tg
vertex_n = 10
g = tg.TinyGraph(vertex_n)
g[3, 4] = 1.0
g[5, 8] = 2.0
Vertex properties and edge properties in TinyGraph have associated NumPy dtypes. This strong typing improves efficiency and serialization/deserialization.
vertex_n = 10
g = tg.TinyGraph(vertex_n, vp_types = {'color' : np.int32,
'is_special' : np.bool})
g[3, 4] = 1.0
g.v['color'][:] = 10
g.v['is_special'][5] = False