Dynamic BFS algorithm to compress graph for reachability queries
Project description
DABFS
DABFS (Dynamic Approach with BFS) is a Python package for query-preserving graph compression. It efficiently compresses directed graphs while preserving reachability queries, enabling scalable query processing on large graphs.
Installation
pip install dabfs
Or, install locally from the repository:
git clone https://github.com/resultugay/dabfs.git
Usage
from dabfs import dabfs_compress
# Call DABFS with your edge list file
dabfs_compress("dabfs/data/simple_graph.txt")
Example Input
A text file containing the edge list of the graph. Each row represents an edge with two columns: source_node and target_node. Example of simple_graph.txt:
1 2
2 3
3 4
4 1
5 6
Example Output
After running dabfs_compress("dabfs/data/wiki.txt"):
2026-04-07 13:49:02,384 - INFO - Total dynamic BFS time for finding all ancestors 7.14 sec
2026-04-07 13:49:13,670 - INFO - Candidate Generated 3.22 sec
2026-04-07 13:49:30,034 - INFO - Saved compressed data dabfs/output/reachibility_query_compressed.txt
2026-04-07 13:49:30,037 - INFO - number of nodes: 7115
2026-04-07 13:49:30,037 - INFO - number of edges: 103689
2026-04-07 13:49:30,037 - INFO - Compressed number of nodes: 3289
2026-04-07 13:49:30,037 - INFO - Compressed number of edges: 77846
2026-04-07 13:49:30,037 - INFO - Compression ratio: 0.73 (73.22%)
2026-04-07 13:49:30,037 - INFO - Compression factor: 0.27 (26.78%)
Basic Example
from dabfs import dabfs_compress
# Compress the graph and save outputs
dabfs_compress("dabfs/data/simple_graph.txt")
Using Compressed Graphs
from graph import Graph
from data_reader import read_data
g = Graph()
compressed_graph = read_data("dabfs/output/reachability_query_compressed.txt",g)
You can now run reachability queries directly on reachability_query_compressed.
Project details
Release history Release notifications | RSS feed
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 dabfs-1.0.0.tar.gz.
File metadata
- Download URL: dabfs-1.0.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a61d6eeb732599f1a1ec8bb337b8888476b41d937627ffea1f7a1a61868f26ed
|
|
| MD5 |
4c2234c2df116865b0b04f8929b65cc2
|
|
| BLAKE2b-256 |
12848ed12559d78c90c9959130aba0d94c1f37a585fce0f718791f0622b406ab
|
File details
Details for the file dabfs-1.0.0-py3-none-any.whl.
File metadata
- Download URL: dabfs-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95db47bb56f066e920725a2c7a4155528e1f1dac1d8c4fb52394e4bd42dc179b
|
|
| MD5 |
d2376abe6f688ca0979de947dd5c4218
|
|
| BLAKE2b-256 |
5976f49e096c4f17d3f8f7e24e0812a821106823319036433d2d3bba6812170f
|