Graph generation and storage library with update tracking
Project description
This library enables fast graph traversal and lookup from file-based storage with sharded and indexed structure. Now includes community exploration.
Features
- Efficient reading of graph data from JSONL files
- Support for multiple indexing strategies (SQLite and Memory)
- Entity caching for improved performance
- Adjacency list-based neighbor lookup
- Property-based entity search
- Community lookup
- Configurable cache size
Architecture
The library is organized into the following components:
Core Components
GraphReader: Main class for reading and querying graph dataGraphReaderConfig: Configuration class for customizing reader behavior
Indexers
The library supports multiple indexing strategies through a plugin architecture:
BaseIndexer: Abstract base class for indexersSQLiteIndexer: SQLite-based indexing for persistent storageMemoryIndexer: In-memory indexing for faster access
Data Structure
The library expects data to be organized in the following directory structure:
base_dir/
├── entities/
│ └── shard_*.jsonl
├── relations/
│ └── shard_*.jsonl
└── adjacency/
└── adjacency.jsonl
Architecture Diagram
graph TD
GR[GraphReader]
GC[GraphReaderConfig]
BI[BaseIndexer]
SI[SQLiteIndexer]
MI[MemoryIndexer]
EF[Entity Files]
RF[Relation Files]
AF[Adjacency File]
DB[(SQLite DB)]
GR --> GC
GR --> BI
SI --> BI
MI --> BI
GR --> EF
GR --> RF
GR --> AF
SI --> DB
style GR fill:#e6f3ff,stroke:#000000,stroke-width:2px,color:#000000
style GC fill:#e6f3ff,stroke:#000000,stroke-width:2px,color:#000000
style BI fill:#fff2e6,stroke:#000000,stroke-width:2px,color:#000000
style SI fill:#fff2e6,stroke:#000000,stroke-width:2px,color:#000000
style MI fill:#fff2e6,stroke:#000000,stroke-width:2px,color:#000000
style EF fill:#f0fff0,stroke:#000000,stroke-width:2px,color:#000000
style RF fill:#f0fff0,stroke:#000000,stroke-width:2px,color:#000000
style AF fill:#f0fff0,stroke:#000000,stroke-width:2px,color:#000000
style DB fill:#f0fff0,stroke:#000000,stroke-width:2px,color:#000000
Installation
pip install beanone-graph
Usage
from graph_reader import GraphReader, GraphReaderConfig
config = GraphReaderConfig(base_dir="graph_output")
reader = GraphReader(config)
# Get an entity
entity = reader.get_entity(1)
print("Entity:", entity)
# Get neighbors
neighbors = reader.get_neighbors(1)
print("Neighbors:", neighbors)
# Search
matches = reader.search_by_property("name", "Alice")
print("Matches:", matches)
# Get entity's community
community = reader.get_entity_community(1)
print("Community:", community)
# Get members of a community
members = reader.get_community_members("team_alpha")
print("Members:", members)
Configuration
The GraphReaderConfig class supports the following parameters:
base_dir: Base directory containing the graph dataindexer_type: Type of indexer to use ("sqlite" or "memory")cache_size: Maximum number of entities to cache in memory
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file beanone_graph-0.1.1.tar.gz.
File metadata
- Download URL: beanone_graph-0.1.1.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abe3ef3e565f79056f3d9b2d3cce4ec8d81de7732545f6d7da9e22308e353b06
|
|
| MD5 |
f5ea8562f19cef57e0356d6e3cb6313d
|
|
| BLAKE2b-256 |
3c2200014de4a51d59c6fa5f5d1944398578af1d4549b445dc92cca43e984625
|
Provenance
The following attestation bundles were made for beanone_graph-0.1.1.tar.gz:
Publisher:
publish.yml on beanone/graph_reader
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
beanone_graph-0.1.1.tar.gz -
Subject digest:
abe3ef3e565f79056f3d9b2d3cce4ec8d81de7732545f6d7da9e22308e353b06 - Sigstore transparency entry: 204551818
- Sigstore integration time:
-
Permalink:
beanone/graph_reader@5e0dd2b58e1288364762d58e840d954ccb8455bd -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/beanone
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5e0dd2b58e1288364762d58e840d954ccb8455bd -
Trigger Event:
push
-
Statement type:
File details
Details for the file beanone_graph-0.1.1-py3-none-any.whl.
File metadata
- Download URL: beanone_graph-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
545c1f8b0117ee0904e07496408f4c8613ae26d9701fd767de08cb86751d1bd1
|
|
| MD5 |
c5ad12d0132c222516cfa2bf3e3dce4f
|
|
| BLAKE2b-256 |
d8b5ff1e8cec88df1dc9d231c12810d07cfce951668bb9143c12f8886635163f
|
Provenance
The following attestation bundles were made for beanone_graph-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on beanone/graph_reader
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
beanone_graph-0.1.1-py3-none-any.whl -
Subject digest:
545c1f8b0117ee0904e07496408f4c8613ae26d9701fd767de08cb86751d1bd1 - Sigstore transparency entry: 204551825
- Sigstore integration time:
-
Permalink:
beanone/graph_reader@5e0dd2b58e1288364762d58e840d954ccb8455bd -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/beanone
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5e0dd2b58e1288364762d58e840d954ccb8455bd -
Trigger Event:
push
-
Statement type: