MemmapGraphStore
¶
MemmapGraphStore(root: str)
Bases: GraphStore
A GraphStore keeping its edges in .npy files, read
through memory mapping, so that a graph converted once (e.g. to CSC)
can be reopened instantly, without parsing or sorting its edges again.
Only homogeneous graphs (edge_type=None) and string edge types are
supported. Files are <root>/<edge_type or "_">.{0,1}.npy plus a
<root>/edges.json index.
Example:
from mlx_graphs.data import MemmapGraphStore
store = MemmapGraphStore("graph/")
colptr, row, perm = InMemoryGraphStore.from_data(data).csc()
store.put_edge_index((row, colptr), layout="csc", size=(n, n))
# later, in another process
store = MemmapGraphStore("graph/")
colptr, row, _ = store.csc()
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
str
|
Directory of the store (created if needed). |
required |
Source code in mlx_graphs/data/graph_store.py
from mlx_graphs.data import MemmapGraphStore · mlx_graphs/data/graph_store.py