Library designed to compress graphs
Project description
graphcompress
graphcompress is a Python library designed to compress graphs from NTRIPLES.
The resultant format writes the info of a node in a line. First the NODE ID, next, groups of connections, every connection has the EDGE ID and NODES CONNECTED USING THE EDGE. Considers a negative EDGE ID as a connection in opposite direction.
Example:
14 5.3.7 -3.2The line says:
- Node 14 connects to Node 3 using Edge 5.
- Node 14 connects to Node 7 using Edge 5.
- Node 2 connects to Node 15 using Edge 3.
Usage
from graphcompress.readers import Reader_NT, Reader_NTgz, Reader_CGgz
from graphcompress.parsers import WikidataParser, CGParser
from graphcompress.builders import Builder
r = Reader_NTgz('graph.nt.gz')
p = WikidataParser()
b = Builder(r,p,'tmp','output.gz')
b.make_partitions()
b.merge_partitions()
Input file:
graph.nt.gz<http://www.wikidata.org/entity/Q1> <http://www.wikidata.org/prop/direct/P5> <http://www.wikidata.org/entity/Q5> . <http://www.wikidata.org/entity/Q1> <http://www.wikidata.org/prop/direct/P3> <http://www.wikidata.org/entity/Q6> . <http://www.wikidata.org/entity/Q6> <http://www.wikidata.org/prop/direct/P5> <http://www.wikidata.org/entity/Q5> . <http://www.wikidata.org/entity/Q6> <http://www.wikidata.org/prop/direct/P5> <http://www.wikidata.org/entity/Q2> .(The lines above are the uncompressed file)
Output file:
output.gz1 5.5 3.6 2 -5.6 5 -5.1.6 6 5.5.2 -3.1(The lines above are the uncompressed file)
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 graph-compress-0.0.1.tar.gz.
File metadata
- Download URL: graph-compress-0.0.1.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
691171198551e9db6e515ccb77e1f25a835e217dffa6f3170a71ecff1eefa3b5
|
|
| MD5 |
5437c81db636b9ff8c66d556d46b4ad9
|
|
| BLAKE2b-256 |
76bb5f2ec8e7de427080c8a9aeadd26b606ac44764479c109c9aff385ba2876f
|
File details
Details for the file graph_compress-0.0.1-py3-none-any.whl.
File metadata
- Download URL: graph_compress-0.0.1-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8ab9dd519c04171c777fa45ae332008b91fba8cb6003b190129b825089d7429
|
|
| MD5 |
cf6367d84d437f73823bda735645bebc
|
|
| BLAKE2b-256 |
de4b05b4b0d3f73d539a5d4b88ac208e47ae2dae08ec01be459b121fade37c27
|